I am new to dsp and just have a vague understanding of fft process. i know fft is used to convert time to freq domain.... i need to generate a sequence of frequencies such that F=[F1,F2,.....Fn-1] where n=16 and then need to do the ifft of it.... i need these freq sequences to be random... My friend told me that the sequence should have both Cos and sin wave making up (a+ib) an complex waveform.... Because i chose random signal in matlab using command rand and he told it generates random signals but only in positive x axis... he said something about choosing any random points from a circle.. i didn't quite understand what he meant by circle... can someone pls explain in simple words... I browsed all over and found fft only for sin or cos wave... how can i input a complex waveform to the fft so that i get a complex freq sequence becoz i read a fft returns a complex value... so am i supposed to input either sin or cos wave and get a complex output or should i input a complex wave... can someone give me a brief code in matlab since i'm trying to implement on matlab so that i can build on the code.. Also i know we input a time domain signal and th signal is sampled and we get bins which builds the freq.. i'm not quite clear in wat way we r supposed to sample and how it is build.. can someone also give an explanation not involving too much maths... Thank you

  • $\begingroup$ First generate the signal s(t) via an iFFT process from a sequence of frequency values: f = [f0, · · · , fn−1.] Choosing n = 16, set up a matlab script that computes the iFFT, add a pulse waveform to its output, and computes the spectrum of s(t) .Chose F such that |fn| = 1, which gives a flat frequency response. This signal s(t) is a pseudo random sequence... and i need to convolute this s(t) with my pulse waveform (binary seq) to see if i'm getting a shaped spectrum.... this is wat i am trying to achieve $\endgroup$ – Priti16 Sep 29 '14 at 9:01
  • $\begingroup$ this is my matlab code------------------------------------%generating uniformly distibuted random frequencies between 1Mhz and 2Mhz x=1e6+(2e6-1e6).*rand(1,16); %calculating ifft of frequencies y=ifft(x); %generating a pulse wave form with 2Ghz freq with a sample rate of 20Ghz fc=2e6; fs = 4e6; % sample freq t = 1 : 1/fs : (1/(2*fc))-(1/fs) ; p(tfs) = 0; l = 1/(2*fc): 1/fs : 1/(fc); p(lfs) = 1; %adding pulse to the IFFT for i=1:1:16 data(length(p)*(i-1)+1:length(p)*i)=conv(abs(y(i)),p); end $\endgroup$ – Priti16 Sep 29 '14 at 9:01

The FFT converts a time-domain signal, which is a series of real numbers, into the frequency domain, as a series of complex numbers. The IFFT converts back again - from the frequency to the time domain.

If I understand correctly, you are trying to produce a series of random amplitudes in the frequency domain, so that you get a random signal back in the time domain when you apply the IFFT. However, convential random numbers are all real-valued, not complex.

The result of an FFT is a sequence of complex numbers of the form (x + iy). This is equivalent to the Cartesian coordinates (x, y). However, it is often easier to think of the FFT results in terms of polar coordinates (r, θ). Here, r represents the amplitude and θ the phase.

So one way to do what you want is to generate a random amplitude r, and a random phase 0 ≤ θ < 2π. Then convert that from polar to Cartesian form. Convert the Cartesian pair to a complex number.

As for the circles - once you've picked your amplitude r, then picking the phase θ is effectively picking one point at random around a circle of radius r.

Aside: The only difference between a sine wave and a cosine wave is the phase. If you feed a pure sine wave into an FFT, you will get a particular complex number out. If you feed in a cosine wave of the same frequency and amplitude, the FFT result will have the same amplitude but a different phase.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.