Stretching data to fit a specific window

5 次查看(过去 30 天)
Hi all,
I have large amounts of data that are sampling at incorrect intervals. I want to compare the signals, but they don't properly line up because of the sampling rate. I want to be able to stretch or shrink the data to a specific number of samples, but maintain overall shape.
x = linspace(0,2*pi,110);
Y = sin(x);
xi = linspace(0,10);
yi = interp1(x,Y,xi);
plot(xi,yi)
What I want out of this is one full cycle of a sin wave, but stretched from a period of 2*pi and 110 samples to a period of 10 with 100 samples even.
I'm sure there is an easy way to do this, but I've been racking my brain and can't seem to find a solution.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Curve Fitting Toolbox 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by