Why do I receive sym/subsasgn error?
显示 更早的评论

The code that I use:
clc;
clear;
close all;
%parameters
R = 8.314;
Tp = 298.15;
Nl = 18.015;
A = 18.3036;
B = 3816.44;
C = -46.13;
Tps = 298.15;
Dp = 0.00152;
rp = Dp/2;
vp = 0.75;
cpp = 4009;
rhod = 1052;
rhog = 0.9995;
ug = 2.087*10^-5;
Dv = 2.931*10^-5;
Cvi = 0.0196;
kg = 0.03;
Tg = 343.15;
hfg = 2.33*10^6;
rhol = 997;
Dls = 1.5*10^-10;
%Algebra eqns
psatv =exp (A-B/(Tp+C))*133.322;
Cvs = (psatv*Nl)/(1000*R*Tp);
Re = (Dp*vp*rhog)/ug;
Sc = ug/(rhog*Dv);
Pr = cpp*ug/kg;
kc = (2+0.6*Re^0.5*Sc^1/3)*Dv/Dp;
alpha = (2+0.6*Re^0.5*Pr^1/3)*kg/Dp;
mp = rhod*(4*pi*rp^3)/3;
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))/(mp*cpp);
odes = [ode1 ode2 ode3];
S = dsolve(odes);
mlSol(t) = S.ml;
rpSol(t) = S.rp;
TpSol(t) = S.Tp;
[mlSol(t), rpSol(t), TpSol(t)] = dsolve(odes);
% time discretization
dt = 0.01;
t0 = 0;
tf = 100;
t = t0:dt:tf;
tspan=[t0 tf];
%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);
fplot(mlSol, 'r', 'linewidth', 2)
title('Droplet mass versus Time')
xlabel('Time,t')
ylabel('Mass, mg')
grid on
fplot(rpSol, 'g', 'linewidth', 2)
title('Droplet size versus time')
xlabel('Time,t')
ylabel('Droplet size, mm')
grid on
fplot(TpSol, 'b', 'linewidth', 2)
title('Temperature versus time')
xlabel('time,t')
ylabel('Temperature, K')
grid on
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Numeric Solvers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!