Plotting ODEs with changing variable

1 visualizzazione (ultimi 30 giorni)
Will Jeter
Will Jeter il 4 Nov 2020
Risposto: Stephan il 5 Nov 2020
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

Risposte (1)

Stephan
Stephan il 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

Community Treasure Hunt

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

Start Hunting!

Translated by