How can I use linear interpolation to have two array with the same length?

Hi everyone.
I have a vibration signal with the length of 30,000 for the duration of 10 s. Let's call it "A". I have defined 30 windows with equal lengths of 1,000 samples. For each window length, I have used frequency spectrum to find the highest peak in the frequency components to calculated the rotational speed from the vibration data. So now, I have 30 speed values over time.
Now, I want to use interpolation for the speed data to create a new array including 30,000 speed data points. What I mean is having both vibration and speed with a same length.
I don't know how feasible this idea is. But if it is, I appreciate any help and suggestions.
Thank you

 Accepted Answer

x=rand(1,30);
xx=interp1(x,linspace(1,30,3e4));
whos x xx
Name Size Bytes Class Attributes x 1x30 240 double xx 1x30000 240000 double

4 Comments

@Matt J Thank you so much, it was a great help. By any chance, do you know how to do achieve the same thing but with quadratic interpolation? I mean extending the number of data point to a desired number.
I don't know about quadratic, but there are non-linear interpolation choices supported by interp1,
You're welcome, but please Accept-click the answer if your question has been resolved.

Sign in to comment.

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Products

Asked:

on 11 Apr 2022

Commented:

on 12 Apr 2022

Community Treasure Hunt

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

Start Hunting!