# 3 Differential equation using 4th order runge kutta

24 views (last 30 days)

Show older comments

### Accepted Answer

Bjorn Gustavsson
on 28 Oct 2021

Edited: Bjorn Gustavsson
on 28 Oct 2021

You have a function for a 2-D system of ODEs. That then is messed up:

function diffeqs =ode_Q10(t,var)

% t = var(1); % This overwrites the value of the independent input-variable t.

% does this mean that you have some other differential equation

% in a variable "T" (just to differentiate if from the

% time-variable "t")? If so then lets introduce it here:

T = var(1);

Xe = var(2);

Te=var(3);

tht = 300;

ko = 4.48e6;

E = 62800;

Rg = 8.314;

Tf = 298;

cf = 3;

Hxn = -2.09e8;

De = 1000;

cp = 4190;

diffeqs(1,1) = sin(t)*T; % Here you better insert the ODE for the "T" variable.

diffeqs (2,1) = (-Xe./tht) + ko.*exp(-E./(Rg.*Te)).*(1-Xe); %dxe/dt

diffeqs(3,1) = ((Tf-Te)./tht) - cf.*(Hxn./De.*cp).*ko.*exp(-E./(Rg.*Te)).*(1-Xe); %dTe/dt

end

This way you will now have a function for 3 ODEs for dT/dt, dXe/dt and dTe/dt. This would then be integrateable with ode45.

HTH

##### 8 Comments

### More Answers (0)

### See Also

### Community Treasure Hunt

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

Start Hunting!