Solve ODE with array forcing function
Show older comments
I want to solve a simple ODE of the form like below ( current in a RL circuit):
dIdt= k1*I+k2*V, where k1 and k2 are constants.
V is a vector of recorded voltage data that can be thought of as V(t) at a specified sampling frequency fs. All examples I find have the forcing term with a dependency on t like sin(t).
How can I formulate this so that my forcing function V gets used without an explicit dependency on t?
Something like:
[t,I]=ode45( @rhs, t, initial_I, k1,k2 V);
function dIdt=rhs(t,x)
dIdt = k1*I + k2*V;
end
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!