Search for a function to repeat time t of the function ODE45 in a cyclic pattern

4 views (last 30 days)
Dear all,
We are working on EMG signals that we should analyse with Matlab.
The EMG signal represents the force of an athlete propulsing his wheelchair. The force F is equal to Fmax during the propulsion time (0.1s) and then equal to 0 during the relaxation time (0.320s). Thus, the corresponding curve that we should obtain with matlab should have a cyclic pattern.
To plot these variations we used [T,Y] = ode45 (@, (t,Y) equa2 (m,g,nu_s, nu_d, C_d,A,Fp,t,Y), [0 60], [0 0], options);
With m,g,nu_s, nu_d, C_d,A,Fp as constant parameters
The problem is that we need to have t varying in the interval [0;0.420] (0.420 = 0.1 + 0.320 = propulsion time + relaxation time).
What is the function we should use to have t in ODE45 varying with a cyclic pattern ?
Thank you in advance for your help,
Mary

Answers (1)

Jan
Jan on 12 Sep 2013
Please note, that ODE45 cannot handle discontinuities in the function to be integrated. See Answers: Problems for integrating discontinuities .
A reliable integration requires to stop and restart the integrator whenever the parameters change. Therefore you need a loop and call ODE45 for the piecewise integration. Therefore the final value of one integration gets the initial value of the next one.

Categories

Find more on Programming 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!