I do not know at which point I make mistake.
function dydt = comb(t,y)
R = 8314.510; % J/kmol.K
Cp = 1200; % J/kg.K
h_F = 4e7; % J/kg
Po = 2545284; % Pa
To = 753; % K
Fo = Po/(17*R*To);
Oxo = 16*Po/(17*R*To);
Pro = 0;
dydt = [-h_F*(-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))/(Cp*Po/(R*y(1)));...
(-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))-(y(2)*(-h_F*(-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))/(Cp*Po/(R*y(1))))/y(1));...
16*((-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))-(y(2)*(-h_F*(-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))/(Cp*Po/(R*y(1))))/y(1)));...
-17*((-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))-(y(2)*(-h_F*(-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))/(Cp*Po/(R*y(1))))/y(1)))]
[t,y]= ode15s(@comb, [0 0.004],[300;Po/(17*R*To);16*Po/(17*R*To);0]);
plot(t,y(:,1),'-o');
title('Temperature vs time');
xlabel('Time, t [s]');
ylabel('Temperature, T[K]');
end

 Réponse acceptée

madhan ravi
madhan ravi le 5 Nov 2018

0 votes

R = 8314.510; % J/kmol.K
Cp = 1200; % J/kg.K
h_F = 4e7; % J/kg
Po = 2545284; % Pa
To = 753; % K
Fo = Po/(17*R*To);
Oxo = 16*Po/(17*R*To);
Pro = 0;
[t,y]= ode15s(@comb, [0 0.004],[300;Po/(17*R*To);16*Po/(17*R*To);0]); %function calling ourside the function definition
plot(t,y(:,1),'-o');
title('Temperature vs time');
xlabel('Time, t [s]');
ylabel('Temperature, T[K]');
function dydt = comb(t,y)
R = 8314.510; % J/kmol.K
Cp = 1200; % J/kg.K
h_F = 4e7; % J/kg
Po = 2545284; % Pa
To = 753; % K
Fo = Po/(17*R*To);
Oxo = 16*Po/(17*R*To);
Pro = 0;
dydt = [-h_F*(-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))/(Cp*Po/(R*y(1)));...
(-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))-(y(2)*(-h_F*(-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))/(Cp*Po/(R*y(1))))/y(1));...
16*((-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))-(y(2)*(-h_F*(-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))/(Cp*Po/(R*y(1))))/y(1)));...
-17*((-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))-(y(2)*(-h_F*(-6.19e9*exp(-15098/y(1))*(y(2)^0.1)*((0.21*y(3))^1.65))/(Cp*Po/(R*y(1))))/y(1)))]
end

4 commentaires

Do I need to write it in separate script?
madhan ravi
madhan ravi le 5 Nov 2018
just copy everything and save it as a script file
It works. Thanks!
madhan ravi
madhan ravi le 5 Nov 2018
Anytime :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by