Plotting ODEs with changing variable

1 次查看(过去 30 天)
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

回答(1 个)

Stephan
Stephan 2020-11-5
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

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by