error: Unrecognized function or variable 'y', using ode45
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Fernanda Vargas
am 24 Feb. 2021
Beantwortet: Walter Roberson
am 24 Feb. 2021
this is my code and i get error: Unrecognized function or variable 'y', please help
function main
a = 0.01725*exp(2660/300);
E = 2660;
T0 = 300;
Cao = 2;
cpa = 20;
cpb = 20;
nao = 2*1200;
nbo = 2*1200;
b = (10*nao)/(cpa*nao+cpb*nbo);
[t,y]=ode45(@(t,y) DiabaticBatch(a,E,T0,Cao,b),[0 4000],[0 0]);
end
function dydt = DiabaticBatch(a,E,T0,Cao,b)
dydt = zeros(2,1);
dydt(1) = a*exp(-E/(T0+y(2)*b))*Cao*(1-y(1))^2;
dydt(2) = b*dydt(1);
end
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 24 Feb. 2021
function main
a = 0.01725*exp(2660/300);
E = 2660;
T0 = 300;
Cao = 2;
cpa = 20;
cpb = 20;
nao = 2*1200;
nbo = 2*1200;
b = (10*nao)/(cpa*nao+cpb*nbo);
[t,y]=ode45(@(t,y) DiabaticBatch(t,y,a,E,T0,Cao,b),[0 4000],[0 0]);
end
function dydt = DiabaticBatch(t,y,a,E,T0,Cao,b)
dydt = zeros(2,1);
dydt(1) = a*exp(-E/(T0+y(2)*b))*Cao*(1-y(1))^2;
dydt(2) = b*dydt(1);
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!