When i run the code, i dont see any plot, and i'm not sure why?

8 views (last 30 days)
figure;
plot(X,del,'color',[0.9290, 0.6940, 0.1250],'linewidth',1.5);
xlabel('Length of Plate (m)','FontSize', 12);
ylabel(' \delta in meter','FontSize', 12);
grid on;
set(gca,'FontSize',16);
title('Velocity boundary layer thickness','FontSize', 12);
  9 Comments
Mathieu NOE
Mathieu NOE on 25 Apr 2022
I don't have the Symb. toolbox (that's why I asked for a mat file)
I will let someone else answer this post
Rik
Rik on 25 Apr 2022
That is not a mat file, that is an m-file. Rule of thumb: if you can run it in the online enviroment, your code is enough for us to debug the problem.

Sign in to comment.

Answers (2)

Sam Chak
Sam Chak on 25 Apr 2022
If you insert this line:
increment = 0;
before this:
m = 0.5 + increment; % Units are in SI
then you can see the plots.

Chunru
Chunru on 26 Apr 2022
syms x;
increment = 0.0;
m=0.5+increment; %Units are in SI
Pr=0.718; %Prandtl number
rho=1.204;%Air density at 20°C in SI (kg/m^3)
Tinf=293; %Entering air temperature at T0 (K)
k=0.0254; %Thermal conductivity (W/m-K)
Mu=1.825*10^-5; %Dynamic Viscosity (kg/m-s)
U0=30; %Velocity of Air (m/s)
U=U0.* (1 + x.^(0.2));
%% BOUNDARY LAYER'S VELOCITTY
dU_dx=diff(U,x);
del2_sq=((0.470*Mu)/(rho*(U^6)))*int(U^5,x,0,x);
fdel2_sq=matlabFunction(del2_sq);
K=(U*rho/Mu)*del2_sq*dU_dx;
fK=matlabFunction(K);
x=0:0.001:0.09;
for i=1:length(x) % to get numerical values
Num_K(i)=fK(x(i));
Num_del2_sq(i)=fdel2_sq(x(i));
end
for i=2:length(x)
eq=[1/82301184 1/4286520 -59/2381400 -74/297675 +1369/99225 -Num_K(i)];
sol=roots(eq);
lambda(i)=real(sol(5)); %real root only
end
Num_K(isnan(Num_K))=0;
Num_del2_sq(isnan(Num_del2_sq))=0;
del_sq = Num_del2_sq.*(lambda./Num_K);
del_sq = Num_del2_sq;
del = sqrt(del_sq); %velocity BL thickness
del(isnan(del))=0;
%% TEMPERATURE(THERMAL) BOUNDARY LAYER
Num_U=U0.* (1 + x.^(0.2)); %numerical_velocity U(x)
syms x zt zeta
Hzt1=@(zt) (zt^4/180) - ((3*zt^3)/140) + ((2*zt)/15);
Hzt2=@(zt) 2/(15*zt^2) - 3/(10*zt) - 3/(140*zt^4) + 1/(180*zt^5) +3/10;
fun1=(rho/Mu)*(Num_U.^2).*del_sq;
X=0:0.001:0.09;
C= [0.01 0.03 0.04 0.06];
for j=1:4
%%%%%%%%solving for zeta(iterative method)
start=(1+(C(j)/0.001));
zeta=zeros(); %initialize
zt=0.9; %%initial assumption
for i=start:91 %x is divided by 91 discrete points
fun=(4/Pr)*(int(U,x,C(j),x)/fun1(i));
fun_x=matlabFunction(fun);
for iteration=1:15 %it will converge to a value
if zt<=1
Hzt=Hzt1(zt); % uses first H(zt)
else
Hzt=Hzt2(zt); % uses second H(zt)
end
zt =real(sqrt(fun_x(X(i))/Hzt));
zt(isnan(zt))=0;
end
zeta(i)=zt;
end
del_t(:,j)=zeta.*del;
end
%% MAXIMUM TEMPERATURE DISTRIBUTION
Qw1=10000; %Heat Flux (W/m^2) %getting heat
T1=real((Qw1.*del_t(:,1)./(2*k))); %max temperature near wall
Qw2=-Qw1; %releasing heat
T2=real((Qw2*del_t(:,2)./(2*k))); %max temperature near wall
Qw3=5000; %Heat Flux (W/m^2) %releasing heat
T3=real((Qw3*del_t(:,3)/(2*k))); %max temperature near wall
Qw4=-Qw3; %releasing heat
T4=real((Qw4*del_t(:,4)/(2*k))); %max temperature near wall
T=real((T1+T2+T3+T4+Tinf)); %Maximum Temperature near wall in(K)
%Velocity, Thermal Boundary Layer and Temperature Distribution plots
if m==0.5 %plot when m=1/2
figure, plot(X,del,'color',[0.9290, 0.6940, 0.1250],'linewidth',1.5);
xlabel('Length of Plate (m)','FontSize', 12);
ylabel(' \delta in meter','FontSize', 12); grid on;
set(gca,'FontSize',16);
title('Velocity boundary layer thickness','FontSize', 12);
for i=1:4
figure, plot(X,del,'color',[ 0.47 0.25 0.80],'linewidth',1.5); hold on;
plot(X,del_t(:,i),'color',[ 0.25 0.80 0.54],'linewidth',1.5); hold on;
xlabel('Length of Plate (m)','FontSize', 12);
ylabel('\delta(m) and \delta_t (m)','FontSize', 16); grid on;
legend('\delta(m) velocity layer','\delta_t(m) Thermallayer','FontSize', 12, 'Location', 'SouthEast')
set(gca,'FontSize',16);
title(['Thermal boundary layer thickness at',num2str(C(i),3),'(m)'],'FontSize', 12);
hold off;
end
figure, plot(X,T,'b','linewidth',1.5);
xlabel('Length of Plate (m)','FontSize', 12);
ylabel('Temprature (K)','FontSize', 16); grid on;
set(gca,'FontSize',16);
title(['Max temprature plot for m = ',num2str(m,3)],'FontSize',12);
end

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!