×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Inverse FFT question

Inverse FFT question

Inverse FFT question

(OP)
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

RE: Inverse FFT question

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));

RE: Inverse FFT question

(OP)
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

RE: Inverse FFT question

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.

RE: Inverse FFT question

(OP)
Okay.

Thanks again!

Jonny

RE: Inverse FFT question

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?

RE: Inverse FFT question

(OP)
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

RE: Inverse FFT question

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.

RE: Inverse FFT question

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources