Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SSS148 on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inverse FFT question 1

Status
Not open for further replies.

JonnyMcK

Electrical
Jul 11, 2005
12
Hi,

I am trying to shift the frequency spectrum of a signal by a fixed amount. A phase vocoder multiplies all frequencies by a fixed factor (for example, a factor of 2 moves 2Hz to 4Hz, 6Hz to 12Hz and so on) but I wish to move every frequency by a set amount (say, add 2Hz so that2Hz to 4Hz, 6Hz to 8Hz).

To do this I was hoping it would be possbile to simply shift the frequency spectrum by the desired amount, and then convert this into the time domain via the inverse Fourier transform.

Basically I'm not really sure how to get from the frequency spectrum back to the time domain.

Any help would be appreciated,
Thanks,
Jonny
 
Replies continue below

Recommended for you

The simplest way to do this is to use the hilbert transform. The example below will shift all frequencies up by 10Hz. Make sure there's nothing too close to nyquist though.

% Create a test signal
t=(0:1023)'/1024;
x1=cos(20*2*pi*t);

z=cos(10*2*pi*t); % 10Hz cosine for a 10Hz shift


% Shift original by +10Hz
x2=real(hilbert(x1).*hilbert(z));

 
That's perfect, thanks!

Can I just ask how close is "too close" to the Nyquist frequency, and what sort of effects would I expect to see if there were some frequency components close to Nyquist?

Cheers,
Jonny
 
If your frequency shift is big enough to shift components so they are above nyquist, they'll be aliased back down. For example, if your nyquist is 22050 Hz and you shift a 20000Hz component up by 3000Hz, it'll show at 21100Hz rather than 25050Hz.

You just need to be aware of this before trusting your results. I guess in practice you could low-pass filter your data before the frequency shift, using one of Matlab's many filter design functions.
 
The simples solution is to rename the pickets.
i.e.
dataTimeDomain = rand( 1, 1024 );
dataFrequencyDomain = fftshift( fft( dataTimeDomain ); )
dataShiftedFequencyDomain = [ dataFrequencyDomain( end ) dataFrequencyDomain( 1 : ( end - 1 ) ) ];

% You will get DC shifted to 2 Hz (in your example). Is this really what you want?
 
Yeah, that's what I was wanting originally.

I have to say SomptingGuy's hilbert transform method worked a treat.....it saves the hassle of calculating the FFT, shifting the spectrum and then obtaining a new time-domain representation from this.

Thanks anyway,
Jonny
 
Can I ask what the practical application of this is? Also, I'd have thought you'd have to be very careful of the usual DC spike on real data. I'm just idly curious, or nosey!

Cheers

Greg Locock

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
Yes, so am I. We use Hilbert for school training and theory , but not in practice very often at all. We typically have an 80% BW limit and use filters and digital quadrature oscillators and you end up with a controlled set of limitations, unlike with the hilbert, where you are at the mercy of the implementation and do not have image control.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor