Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Solving ODE with variable coefficients

Subject: Solving ODE with variable coefficients

From: M.E.L.

Date: 13 Dec, 2012 22:06:09

Message: 1 of 2

I am trying to solve an ODE that has coefficients that vary in time (they're Gaussian functions that I can find analytically with some time array). Do I need to pass some other function for my coefficients into my ode function so that it evaluates the coefficient at each time step? If so, how do I do that?

Thanks!

Subject: Solving ODE with variable coefficients

From: Torsten

Date: 14 Dec, 2012 07:45:09

Message: 2 of 2

"M.E.L." wrote in message <kadjgh$kf8$1@newscl01ah.mathworks.com>...
> I am trying to solve an ODE that has coefficients that vary in time (they're Gaussian functions that I can find analytically with some time array). Do I need to pass some other function for my coefficients into my ode function so that it evaluates the coefficient at each time step? If so, how do I do that?
>
> Thanks!

The ODE solvers can handle differential equations of the general form
dy/dt = f(t,y).
So, any function depending on time and the solution variable is allowed in your ode routine.
If you have inputs for the ode function that are only given at discrete times, use
interp1 to interpolate these inputs to the respective time required by the solver.

Best wishes
Torsten.
 

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us