Time shifting through the frequency domain - DSP
This is a discussion on Time shifting through the frequency domain - DSP ; Dear Group,
I could use some help understanding why my attempt to time-shift via the
frequency domain is not working and what I need to do to make it work.
I thought the Matlab code below would take a 1 ...
-
Time shifting through the frequency domain
Dear Group,
I could use some help understanding why my attempt to time-shift via the
frequency domain is not working and what I need to do to make it work.
I thought the Matlab code below would take a 1 Hz sine wave and shift it
1/4 wavelength to the right. It does not.
Have I botched the phase delay? Is my complex-to-real IFFT wrong?
NUM_PTS = 16;
delta = 1/NUM_PTS;
t = [0:delta:1-delta];
x = sin(2*pi*1*t);
y = fft(x, NUM_PTS);
phase_delay = exp(-i*2*pi*4*t/NUM_PTS); % To shift in time by 4/16
samples
y_delayed = phase_delay .* y;
x_shifted = ifft([y_delayed(1:1:length(y_delayed)/2) 0
conj(y_delayed(length(y_delayed)/2:-1:2))]);
x
x_shifted
Thanks very much.
Mikial
-
Re: Time shifting through the frequency domain
On Jul 23, 5:24 am, "Mikial Chubarov" <mikialchuba...@ieee.org> wrote:
> Dear Group,
>
> I could use some help understanding why my attempt to time-shift via the
> frequency domain is not working and what I need to do to make it work.
>
> I thought the Matlab code below would take a 1 Hz sine wave and shift it
> 1/4 wavelength to the right. It does not.
>
> Have I botched the phase delay? Is my complex-to-real IFFT wrong?
>
> NUM_PTS = 16;
> delta = 1/NUM_PTS;
> t = [0:delta:1-delta];
> x = sin(2*pi*1*t);
> y = fft(x, NUM_PTS);
> phase_delay = exp(-i*2*pi*4*t/NUM_PTS); % To shift in time by 4/16
> samples
> y_delayed = phase_delay .* y;
> x_shifted = ifft([y_delayed(1:1:length(y_delayed)/2) 0
> conj(y_delayed(length(y_delayed)/2:-1:2))]);
>
You want to shift by 16/4 = 4 samples, not 4/16!
--
Oli
-
Re: Time shifting through the frequency domain
>
>
>You want to shift by 16/4 = 4 samples, not 4/16!
>
>
>--
>Oli
>
>
Yikes. Much better! Thank you Oli.
Mikial
Similar Threads
-
By Application Development in forum DSP
Replies: 4
Last Post: 11-26-2007, 10:10 AM
-
By Application Development in forum DSP
Replies: 0
Last Post: 11-26-2007, 08:56 AM
-
By Application Development in forum DSP
Replies: 2
Last Post: 11-22-2007, 12:46 PM
-
By Application Development in forum DSP
Replies: 2
Last Post: 10-05-2007, 02:03 PM
-
By Application Development in forum DSP
Replies: 4
Last Post: 09-29-2007, 10:11 PM