Stretching data to fit a specific window

6 visualizzazioni (ultimi 30 giorni)
Brig
Brig il 11 Giu 2012
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.

Risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by