Plot between Nu vs Ra
2 views (last 30 days)
Show older comments
I need to plot for Nu vs Ra.
The given code is giving multiple plots.
I need a single plot for Nu vs Ra.
Please check the code for single plot. Thanks in advance.
D = 0.1;
L = 0.1;
B = 0.1;
xi = 0.1;
sigma1 = B^3 * D^2 * L^3;
sigma2 = D^2 * L^3;
Ra_values = 10:100:100000;
solutions = zeros(length(Ra_values), 7);
for i = 1:length(Ra_values)
Ra = Ra_values(i);
R = Ra * xi;
f1 = @(A) -((5*A(2)*A(6)*pi^5*B^2*D^2*L^4)/8 + (A(2)*A(6)*pi^5*D^4*L^4)/4)/sigma1 - (B * ((A(4)*A(7)*D^4*pi^5)/4 - (A(1)*L^4*pi^4)/2 - (32*A(5)*L^4*Ra)/9 + (A(1)*L^4*R*pi^2)/2 + (5*A(4)*A(7)*D^2*L^2*pi^5)/8))/sigma2;
f2 = @(A) -(B^2 * (A(2)*A(5)*D^2*L^4*pi^5 - (A(2)*D^2*L^4*pi^4)/2 - (A(1)*A(6)*D^2*L^4*pi^5)/8 - (4*A(6)*D^2*L^4*Ra)/9 + (A(4)*A(7)*D^2*L^4*pi^5)/2 + (3*A(4)*A(7)*D^4*L^2*pi^5)/16 + (A(2)*D^2*L^4*R*pi^2)/4) - (A(2)*D^4*L^4*pi^4)/4)/sigma1 - (B * ((A(4)*A(7)*D^4*pi^5)/8 - (A(2)*L^4*pi^4)/4 - (16*A(6)*L^4*Ra)/9 + (A(2)*L^4*R*pi^2)/4 + (5*A(4)*A(7)*D^2*L^2*pi^5)/16))/sigma2;
f3 = @(A) (B * ((16*A(7)*L^4*Ra)/9 + (A(3)*D^4*pi^4)/4 + (A(3)*L^4*pi^4)/4 - (A(3)*L^4*R*pi^2)/4 + (A(3)*D^2*L^2*pi^4)/2 + (A(1)*A(7)*D^2*L^2*pi^5)/8 - A(3)*A(5)*D^2*L^2*pi^5 - (A(4)*A(6)*D^2*L^2*pi^5)/2))/sigma2 - (B^2 * ((3*A(4)*A(6)*pi^5*D^4*L^2)/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4 + (A(3)*A(4)*D^4*pi^5)/4 - A(6)*L^4*R*pi^2 + (A(3)*A(4)*D^2*L^2*pi^5)/4)/sigma2;
f7 = @(A) (B * ((4*A(3)*L^4*Ra)/9 + (A(7)*D^4*pi^4)/4 + 4*A(7)*L^4*pi^4 - A(7)*L^4*R*pi^2 + 2*A(7)*D^2*L^2*pi^4 + (A(1)*A(3)*D^2*L^2*pi^5)/8 + (A(2)*A(4)*D^2*L^2*pi^5)/16))/sigma2 + (B^2 * ((3*A(2)*A(4)*pi^5*D^4*L^2)/16 + (A(2)*A(4)*pi^5*D^2*L^4)/4) + (A(2)*A(4)*D^4*L^4*pi^5)/4)/sigma1;
F = @(A) [f1(A); f2(A); f3(A); f4(A); f5(A); f6(A); f7(A)];
A0 = [0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001];
A = fsolve(F, A0);
solutions(i, :) = A;
end
A1_1_1 = solutions(:, 1);
A2_1_1 = solutions(:, 5);
Nu = xi - 1./2 - (pi^3 ./ Ra_values) .* A1_1_1 - (8 * pi^3 ./ Ra_values) .* A2_1_1;
plot(Ra_values, Nu);
xlabel('Ra');
ylabel('Nu');
0 Comments
Answers (1)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!