2nd order ODE with time-dependent parameters
이전 댓글 표시
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.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!