How to generate 3 plot? It only appear 1 plot from the coding.

2 views (last 30 days)
%Solve for ml, Tp and rp
close all;
R = 8.314; %gas constant J/mol K - the temperature must be absolute!
Tp = 298.15; %Initial temperature of the droplet/particle K
Nl = 18.015; %Molecular weight of the water, g/mol
A = 18.3036; %Antoine constant
B = 3816.44; %Antoine constant
C = -46.13; %Antoine constant
Tps = 298.15; %Temperature of particle at surface,
Dp = 0.00152; %Diameter of droplet/particle, m
rp = Dp/2; %Radius of the droplet/particle, m
vp = 0.75; %Velocity of droplet/particle, m/s
cpp = 4009; %Specific heat capacity of the droplet/particle, J/kg K
rhod = 1052; %Density of the droplet, kg/m3
rhog = 0.9995; %Density of drying gas, kg/m3
ug = 2.087*10^-5; %Viscosity of drying gas, kg/m s
Dv = 2.931*10^-5; %Vapour air diffusion coefficient, m2/s
Cvi = 0.0115; %Vapour concentration in the drying gas, kg/m3
kg = 0.03; %Thermal conductivity of drying gas, W/m K
Tg = 343.15; %Temperature of drying gas, K
hfg = 2.33*10^6; %Latent heat of vapourisation, J/kg
rhol = 997; %Density of the water, kg/m3
Dls = 1.5*10^-10; %Diffusivity of water into solid,m2/s
%Algebra eqns
psatv =exp (A-B/(Tp+C))*133.322; %Saturated vapour pressure,Pa
Cvs = (psatv*Nl)/(1000*R*Tp); %Surface vapour concentration, kg/m3, assuming the partial pressure of vapours at the surface to be in equilibrium with the liquid phase
Re = (Dp*vp*rhog)/ug; %Reynolds number
Sc = ug/(rhog*Dv); %Schmidt number
Pr = cpp*ug/kg; %Prandtl number
kc = (2+0.6*Re^0.5*Sc^1/3)*Dv/Dp; %Mass transfer coefficient, m/s
alpha = (2+0.6*Re^0.5*Pr^1/3)*kg/Dp; %Heat transfer coefficient, W/m2K
mp = rhod*(4*pi*rp^3)/3; %mass of droplet
%Define the equations using == and represent differentiation using the diff function.
syms ml(t) rp(t) Tp(t)
ode1 = diff(ml,t) == -4*pi*(rp)^2*kc*(Cvs-Cvi);
ode2 = diff(rp,t) == -4*pi*(rp)^2*kc*(Cvs-Cvi)./(4*pi*rhol*(rp)^2);
ode3 = diff (Tp,t) == -4*pi*(rp)^2*alpha*(t)*(Tp-Tg)-hfg*(-4*pi*(rp)^2*kc*(Cvs-Cvi))/(ml*cpp);
odes = [ode1 ode2 ode3];
%Solve the system using the dsolve function which returns the solutions as elements of a structure.
S = dsolve(odes);
%To access ml(t), rp(t) and Tp(t), index into the structure S.
mlSol(t) =;
rpSol(t) = S.rp;
TpSol(t) = S.Tp;
[mlSol(t), rpSol(t), TpSol(t)] = dsolve(odes);
%Initial conditions
cond1 = ml(0) == 1.93*10^-6;
cond2 = rp(0) == 0.00076;
cond3 = Tp(0) == 298.15;
conds = [cond1 cond2 cond3];
[mlSol(t), rpSol(t), TpSol(t)] = dsolve(odes, conds);
% Visualize the solution using fplot.
fplot(mlSol, 'r', 'linewidth', 2)
title('Droplet mass versus Time')
ylabel('Mass, mg')
grid on
fplot(rpSol, 'g', 'linewidth', 2)
title('Droplet size versus time')
ylabel('Droplet size, mm')
grid on
fplot(TpSol, 'b', 'linewidth', 2)
title('Temperature versus time')
ylabel('Temperature, K')
grid on

Answers (1)

Yusuf Suer Erdem
Yusuf Suer Erdem on 16 Nov 2021
x = linspace(0,10,50);
y1 = sin(x);
title('Combine Plots')
hold on
y2 = sin(x/2);
y3 = 2*sin(x);
hold off
You can use this method. After drawing first plot, you can hold it on and when you finish with the others you can hold it off. Good luck!
  1 Comment
Faridatul Ain Binti Mohd Rosdan
I think my question is confusing. I am sorry for that. I want to generate 3 different figures. From my coding, only the first figure appeared.

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!