Solution of differential equations with an input derivative

2 views (last 30 days)
How can I use ode45 in order to find a solution to differential equations with an input derivative
For example I have
[t,x] = ode45(@fcn,[0 tmax],zeros(5,1));
function dx = fcn(t, x)
e = -x(1) + 1;
dx = [(x(2)-x(1))/T2; (x(3)-x(2))/T1; x(4); E_DOT*(kr+Tr/T3)+e*kr/T3-x(4)/T3; e^2];
end
In the above code I need to replace "E_DOT" with the derivative of e. How can I do it?
T1, T2, kr and Tr are constants.

Accepted Answer

David Goodmanson
David Goodmanson on 19 Nov 2020
Hi Pawel,
you have
e = -x(1) + 1;
so
de/dt = d/dt(-x(1) + 1) = -dx(1)/dt
but
dx(1)/dt = (x(2)-x(1))/T2
so you can replace E_DOT with
-(x(2)-x(1))/T2

More Answers (0)

Community Treasure Hunt

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

Start Hunting!