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

 Accepted Answer

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 Comments

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

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!