ode45 returns a vector of length 0
3 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone,
I am trying to solve a DE with ode45 however, ode45 returns a vector of length 0. Thanks in advance.
%% Clean the Workspace
clc
clear all
%% Variables
Vceo = 102.687; % m3
Cv = 1.48; % kj/kg.C
deltaHcond = 2220; % kj/kg
mCond = 50; % kg/sec
mS = 77.413098; % kg/sec
R = 0.082057338; % atm.l/mol.K
MW = 18; % kg/kmol
cpS = 1.87; % kj/kg.C
t0 = 115; % Initial temp
t_interval = [0 50]; % Time interval
IC = [t0]; % Initial Conditions
alfa = (cpS*mS-deltaHcond*mCond)/(Cv*(mS-mCond));
%% Solve the DE
[t,Tsol] = ode45(@(t,T) cfunc(t,T) , t_interval , IC);
%% Plotting
plot(t,Tsol)
function dTdt = cfunc(t,T)
global alfa
dTdt = (T*alfa-T)/t ;
end
0 件のコメント
採用された回答
Askic V
2023 年 1 月 31 日
I see few problems. First have a look at this suggestion:
Coefficient alfa is huge, so change in tempearture is very fast, therefore I use damping coeff 0.0001. I have changed the interval also.
Vceo = 102.687; % m3
Cv = 1.48; % kj/kg.C
deltaHcond = 2220; % kj/kg
mCond = 50; % kg/sec
mS = 77.413098; % kg/sec
R = 0.082057338; % atm.l/mol.K
MW = 18; % kg/kmol
cpS = 1.87; % kj/kg.C
t0 = 115; % Initial temp
t_interval = [0.1 2]; % Time interval--change
IC = t0; % Initial Conditions
alfa = 0.0001* (cpS*mS-deltaHcond*mCond)/(Cv*(mS-mCond));% alfa is too big
% Solve the DE
[t,Tsol] = ode45(@(t,T) cfunc(t,T, alfa) , t_interval , IC);
% Plotting
plot(t,Tsol, '-o')
function dTdt = cfunc(t,T, alfa)
dTdt = (T*alfa-T)/t ;
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!