I have a second order diferential equation:
k1 * d2a + k2 * da + a = e
where a and e are functions of t. I have e(t) in a matrix DATA where:
t = DATA(:,1)
e = DATA(:,2)
If I define the function to be used in ode45 solver as:
function dx = myFUN(t,x) dx = zeros(2,1); dx(1) = x(2); dx(2) = 1/k1*(-k2*x(2)-x(1)+ e(t));end
How can I pass the value of e(t) on each time step?
Best Answer