resample results are abnormal
Show older comments
I used resample(n,p,q) to equalize length of vectors.
each vectors are EMG sampled data, and sampling rate is 2000Hz.
After resampling, there are vibrating data which couldn't see at original data.
I'm not sure what I did wrong, why those vibrating data showed?
here's my code;
CommonLength = 1000;
emgtemporary = emg_low; % emg_low means a target vector to resample, also means one of EMG sampled data.
EMG_FINAL(:,1) = resample(emgtemporary,CommonLength,length(emgtemporary));
here's data plot;
blue one is data which didn't resampled, orange one is resampled data. vibration is appear at both end of data plot.

5 Comments
Those are artifacts due to the fact that your datavalues does not start and end with zero values:
"When filtering, resample assumes that the input sequence, x, is zero before and after the samples it is given. Large deviations from zero at the endpoints of x can result in unexpected values for y."
See also:
You can use INTERP1 to efficiently detrend and retrend the data:
GI JOON SONG
on 25 Apr 2023
Mathieu NOE
on 17 May 2023
you could also use interp1 to resample data
that should not create these ringing effects
Stephen23
on 17 May 2023
@Mathieu NOE: they are not equivalent, see the explanation here:
Mathieu NOE
on 17 May 2023
yes , generally speaking you're right
nevertheless, when you see here that a signal contains several thousands of samples per period , (and looks like a distorded sine) that means we are very far from a risk of aliasing with interp1 unless you would use interp1 with only less than 5 samples total. Need a bit of thinking ....
would like to see the difference in outputs of both methods on this signal (if the data was available)
Answers (0)
Categories
Find more on Multirate Signal Processing 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!