I have to do a 3D plot for rotating disk but i am not getting a 3D plot
35 views (last 30 days)
Show older comments
Noor
on 27 Dec 2024 at 8:14
Answered: Divyajyoti Nayak
on 27 Dec 2024 at 10:47
this is what i was trying to get but all i am getting are multiple circle using the Plot3 command
% for 3D plot i was using the follwoing code
sol = nanowithrotation1;
F=sol.y;
f=F(1,:);
g=F(4,:);
%%theta=linspace(0,360,360/2.608695);
r=linspace(0,10,10/0.07246);
syms t
Ut=r.*f.*cos(t)-r.*g.*sin(t);
Vt=r.*f.*sin(t)+r.*g.*cos(t);
size(Ut)
size(Vt)
fplot3(Ut, Vt, t, [0 2*pi], 'LineWidth', 0.5)
%the function " nanowithrotation1" called in the above code is as follows
function [sol_6]=nanowithrotation1
format long g
global Q w0 exi M Ma omega_w gamma_inf Nrd Pr phi rho_s rho_f k_f k_s cp_f cp_s sigma_s sigma_f A1 A2 A3 s a b beta
etaMin = 0;
inf_1 =5;
etaMax1=inf_1;
stepsize1=etaMax1;
tol=1e-6;
% defining parameters
Q=0.5;
w0= 0.5; % suction parameter
Nrd=0.5;
% omega_w= 0.3; % rotation at z=0
% gamma_inf=1; % rotation at z=inf
exi= 1; % ratio of rotations
Ma = 1.5; % marangoni number
Pr=6.2; %prandtl number
rho_s= 8933 ; % density of nanoparticle
rho_f= 997.1 ; % density of base fluid
phi= 0.1; % concentration of nanofluid
k_f= 0.613 ; % thermal conductivity of base fluid
k_s= 400 ; % thermal conductivity of nanoparticle
cp_f= 4179 ;
cp_s = 385;
sigma_f= 0.05; % electric conductivity of base fluid
sigma_s= 5.96*10^7; % electric conductivity of nanoparticle
% beta= ((k_s+2*k_f)-2*phi*(k_f-k_s))/((k_s+2*k_f)+phi*(k_f-k_s)); % ratio of thermal conductivity of nanoparticle to that of nanofluid
% alpha= 1+64.7*phi^(0.7460) *((d_f/d_p)^0.3690)*((k_s/k_f)^0.7476)*((mu*cp_f/k_f)^0.9955)*(rho_f*B_c*T/(3*pi*mu^2*l_bf))
% a= (1-phi)+(phi*(rho_s/rho_f));
% A1= ((1-phi)^2.5)*a;
% s=sigma_s/sigma_f;
% b= 1+((3*phi*(s-1))/((s+2)-(phi*(s-1))));
% A2=b/a;
% A3= (1-phi)+(phi*(rho_s*cp_s)/(rho_f*cp_f));
% A4=(beta*(3+(4*Nrd)))/(3*A3);
% SOLUTION
beta=1;
A1=1;A2=1;A3=1;A4=1;
s=1;a=1; b=1;
phi=0;
% options = bvpset('stats','on');
options = bvpset('stats','off','RelTol',tol);
solinit = bvpinit(linspace(etaMin,etaMax1,stepsize1),zeros(7,1));
sol_6 = bvp4c(@OdeBVP,@OdeBC,solinit,options);
eta=linspace(etaMin,etaMax1,stepsize1);
xsol = sol_6.x;
ysol = sol_6.y;
ysol(:,1)
%y = deval(sol_1,eta);
% plot for first solution
figure(1);
plot(sol_6.x,sol_6.y(1,:),'g-','LineWidth',1) % y(1)= F
xlabel('\eta')
ylabel('F(\eta)') % label for y axis
box on
hold on
figure(2);
plot(sol_6.x,sol_6.y(2,:),'c-','LineWidth',1) % y(2)= F'
xlabel('\eta')
ylabel('dF(\eta)') % label for y axis
box on
hold on
figure(3);
plot(sol_6.x,sol_6.y(4,:),'b-','LineWidth',1) %y(4)= G
xlabel('\eta')
ylabel('G(\eta)') % label for y axis
box on
hold on
figure(4);
plot(sol_6.x,sol_6.y(6,:),'r','LineWidth',1) % y(6) = theta
xlabel('\eta')
ylabel('\theta(\eta)') % label for y axis
box on
hold on;
figure(5);
plot(xsol,ysol(1,:), 'g', xsol,ysol(4,:), 'b', xsol,ysol(6,:), 'r','LineWidth',1)
hold all
% saving output in text file for first solution
descris =[sol_6.x; sol_6.y];
save 'slip_upper.txt' descris -ascii;
fprintf('\nFirst solution:\n');
fprintf('\nFirst solution:\n');
fprintf('\n');
function fff = OdeBVP(~,y)
Eq1=A1* ((y(2)^2)-(2*y(1)*y(3))-(y(4)^2)+(exi^2));
Eq2=A1 *((2*y(2)*y(4))-(2*y(1)*y(5)));
Eq3= (Pr/A3)*(2*y(2)*y(6)-(2*y(1)*y(7))-((Q*y(6))/(2*A2)));
fff=[y(2);
y(3);
Eq1;
y(5);
Eq2;
y(7);
Eq3];
end
%% RESIDUAL FOR BOUNDARY CONDITIONS
function res = OdeBC(y0, yinf)
res = [
y0(1)-w0;
y0(3)+2*Ma*((1-phi)^2.5);
y0(4)-1;
y0(6)-1;
yinf(2);
yinf(4)-exi;
yinf(6)];
end
end
1 Comment
Divyajyoti Nayak
on 27 Dec 2024 at 8:27
Hi @Noor, it would be easier for others to help if you could put all the lines of code into the code block.
Accepted Answer
Divyajyoti Nayak
on 27 Dec 2024 at 10:47
I ran your code and the final plot obtained is actually a 3d plot but looks 2d because it’s a top down perspective. This is caused due to the ‘hold on’ command used before a 3d plotting function which defaults the axis to 2d.
To make the default axis 3d, consider changing the code to use the ‘fplot3’ function first and then use ‘hold on’.
To view the 3d plot without changing the code, you can use the ‘Rotate 3D’ tool to change the perspective.
0 Comments
More Answers (0)
See Also
Categories
Find more on Calculus 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!