Plotting ODEs with changing variable
1 view (last 30 days)
Show older comments
Im trying to plot conversion in terms of theta but i cant get it to work
theta = [0,15];
Conversion = [0];
[TH, X] = ode45(@odefun5,theta,Conversion);
figure
plot(TH,X)
xlabel('Theta')
ylabel('Conversion')
legend('X')
function dXdV = odefun5(TH,X)
CA0 = 2/0.082/1100;
CI0 = CA0;
FA0 = 10;
CA01 = (CA0+CI0)/(theta+1);
e = 1/(1+theta);
T0 = 1100;
dHrx = 80000;
CpA = 170;
CpI = 200;
T = (X*(-dHrx)+(CpA+theta*CpI)*T0)/(CpA+theta*CpI);
k = exp(34.34-(34222/T));
ra = -k*CA01*(1-X)*T0/(1+e*X)/T;
dXdV = -ra/FA0;
end
0 Comments
Answers (1)
Stephan
on 5 Nov 2020
tspan = [0,15];
Conversion = [0];
[TH, X] = ode45(@odefun5,tspan,Conversion);
figure
plot(TH,X)
xlabel('Theta')
ylabel('Conversion')
legend('X')
function dXdV = odefun5(theta,X)
CA0 = 2/0.082/1100;
CI0 = CA0;
FA0 = 10;
CA01 = (CA0+CI0)/(theta+1);
e = 1/(1+theta);
T0 = 1100;
dHrx = 80000;
CpA = 170;
CpI = 200;
T = (X*(-dHrx)+(CpA+theta*CpI)*T0)/(CpA+theta*CpI);
k = exp(34.34-(34222/T));
ra = -k*CA01*(1-X)*T0/(1+e*X)/T;
dXdV = -ra/FA0;
end
0 Comments
See Also
Categories
Find more on Ordinary Differential Equations 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!