[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Interpolating signal from 4 sec to 1 sec
From: |
Rick T |
Subject: |
Interpolating signal from 4 sec to 1 sec |
Date: |
Thu, 31 Mar 2011 20:13:58 -1000 |
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
--
-
- Interpolating signal from 4 sec to 1 sec,
Rick T <=