The output of function resample shows a signal with peaks unexpected

4 visualizzazioni (ultimi 30 giorni)
Hello everybody,
I have a issue, the resample function is supposed to give you a rough signal with new data added. But in my case, for instance, the two first adjacent samples have almost the same value, in other words are constant in tim; and it is supposed the aproximation signal at the beginning should show a serial points with the same value.
Here is the issue. The resampled output signal shows a peak curve at the begining. The data points are sampled irregularly, so the arrangement of the points are not spaced equally in time. The average of period that I calculated is 0.051 s. But from the source of data tells me that they was sampled with 0.034 s. So for that reason I've tried get a new signal with estimated added points as shown in the picture below. I want to understand why it happens and/or how to solve it. Thank you.
realPeriod=34e-3;% Check-in
[newMag, newTime] = resample(magAxis_xyz{1}(2,:), magTime{1}', 1/realPeriod, 1, 1, 'spline');
Original signal

Risposta accettata

Star Strider
Star Strider il 10 Mag 2020
...the resample function is supposed to give you a rough signal with new data added.
I am not certain of the specific syntax you are using with resample, and particularly what those variables are. However, the resample function only interpolates the input data to a new time vector (it does not actually ‘add’ anything else, and uses an anti-aliasing filter to prevent problems associated with the interpolation), usually defined by the sampling frequency argument and produces an accurate (not ‘rough’) interpolation. You are also using the 'spline' interpolation method, and that can have unpredictable results with step transitions such as exist at the beginning of your signal, and noise that exists in much of the rest of it. I always use the default 'linear' method, and have always been pleased with the results.
  2 Commenti
Sergio Cuadros
Sergio Cuadros il 11 Mag 2020
Now I get it, the type of intepolation method influence the results. I thought that with a higher order of interpolation it can result very good estimation between two samples and can representate the physical signal quite good. Thaks for the anwer.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by