2nd order ODE with time-dependent parameters
Afficher commentaires plus anciens
Hi, I am a little stuck trying to create an ODE function which has a time dependent variable. At first I had the following which worked well:
K = ...;
r = ...;
C = ...;
m = ...;
myODE = @(t,z) [z(2);(F - K*r*z(1) - C*r*z(2))/m];
However now, I'd like F to change as a function of time. I looked into using 'interp1' from the example on the Mathworks site but I'm still confused as to how to use it. I essentially want to change F from a step to a sine or ramp wave. Have F start at 0 and over 2 seconds ramp it up to another value.
I'm not looking for a complete solution, but I'd like to know how I can successfully use the interp1 function.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!