Plotting ODEs with changing variable

1 visualización (últimos 30 días)
Will Jeter
Will Jeter el 4 de Nov. de 2020
Respondida: Stephan el 5 de Nov. de 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

Respuestas (1)

Stephan
Stephan el 5 de Nov. de 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

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by