The output of function resample shows a signal with peaks unexpected

4 次查看(过去 30 天)
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

采纳的回答

Star Strider
Star Strider 2020-5-10
...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 个评论
Sergio Cuadros
Sergio Cuadros 2020-5-11
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by