Best way to resample the output of a Simulink simulation with variable time step into a signal with a fixed sample time
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Bill Tubbs
il 29 Ott 2020
Commentato: Ameer Hamza
il 30 Ott 2020
I have a simulation model that runs with a variable timestep:
(I don't want to change this)
For the purpose of system identification it would be convenient to have the output signals sampled at a regular frequency.
This seems to work:
y_resampled = resample(simOut.POW,simOut.POW.Time)
According to the documentation, this resamples the values, simOut.POW, by linear interpolation onto a vector of uniformly spaced instants with the same endpoints and number of samples as simOut.POW.Time.
Not sure if it is the right way to do it or if there is a better function to use.
0 Commenti
Risposta accettata
Ameer Hamza
il 29 Ott 2020
No, resample() samples the signal at vector specified by simOut.POW.Time. So, in this case, it is not doing anything. I suggest using interp1()
t_equally_spaces = min(simOut.POW.Time):0.01:max(simOut.POW.Time);
y_resamples = interp1(simOut.POW.Time, simOut.POW.Data, t_equally_spaces)
5 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Multirate Signal Processing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!