
From:  William Krekeler 
Subject:  RE: Interpolating signal from 4 sec to 1 sec 
Date:  Fri, 1 Apr 2011 13:42:07 +0000 
From:
address@hidden [mailto:address@hidden On
Behalf Of Rick T Interpolating signal from 4 sec to 1 sec tia sal22 Greetings All I have a signal that cycles twice from 0 to 4 seconds
and would like to interpolate the signal to cycle twice when it goes from 0 to 1 second. I know it's an issue with
my xi variable I'm just not sure how to fix it. PS: the example is just a simple sine wave equation but I'll
be importing an audio wav file, that's why I chose to use interpolate %Interpolation test clear all, clc,clf,tic x= linspace(0,2*pi,400); %from 0 to 4 sec fs_rate=100 freq=2; y=sin(freq*(x)); xo=linspace(0,length(y)/fs_rate,length(y)); %go from 0 to x
sec xi=linspace(0,1,length(y)); %go from 0 to 1 sec new_y=interp1(xo,y,xi,'linear'); subplot(2,2,1),plot(xo,y),title('Orginal signal over 4 sec') subplot(2,2,3),plot(xi,new_y),title('Entire signal over 1
sec') tia sal22
Not sure why you would only want to interpolate a portion of the
signal as you would then have two different effective sample rates which will impact
your ability to analyze the data. A quick interpolation method is the function
spline. Bill Krekeler 
[Prev in Thread]  Current Thread  [Next in Thread] 