error: Unrecognized function or variable 'y', using ode45
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Fernanda Vargas
le 24 Fév 2021
Réponse apportée : Walter Roberson
le 24 Fév 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 commentaires
Réponse acceptée
Walter Roberson
le 24 Fév 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!