Solving ODE using ODE45

1 view (last 30 days)
its
its on 20 Aug 2014
Answered: Star Strider on 20 Aug 2014
Hello everybody, I have two ordinary coupled differential equations.viz., df/dt = -k*f; and dq/dt = -k*q + f;. where, k is a vector of size 111*1 whose values are known at definite time intervals (i.e., the timespan vector is fixed) and I want to solve for the unknowns which are f and q here using "ode45".The initial condition is f0 = 10 ; q0 = 0; I have attached the files for t and k. for a particular time i will have to use corresponding k value. Any help will be appreciated

Answers (1)

Star Strider
Star Strider on 20 Aug 2014
You don’t need ode45 for these or even the Symbolic Math Toolbox (although I used it because I don’t feel sufficiently energetic to solve your equations by hand today).
As anonymous functions, they are:
f = @(k,t) 10*exp(-k.*t);
q = @(k,t) 10*t.*exp(-k.*t);

Tags

Community Treasure Hunt

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

Start Hunting!