comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: FFT confusion
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: FFT confusion [message #35212 is a reply to message #35151] Thu, 15 May 2003 08:38 Go to previous messageGo to previous message
K. Bowman is currently offline  K. Bowman
Messages: 330
Registered: May 2000
Senior Member
In article <7126861e.0305150615.29c97045@posting.google.com>,
jefield@taz.qinetiq.com (Julian Field) wrote:

> Hi,
>
> I'd be enormously grateful if anyone could help me with this.
>
> I'm looking at the power spectra of "chirp" radio signals and am
> having problems getting sensible plots. The following code should
> generate a complex sinusoidal chirp whose frequency runs from 100 to
> 150 Hz and then plot its power spectrum:
>
> However I'm getting a frequency spectrum running from 100 to *200* Hz
> and I'm really confused. This problem has been bugging me for ages and
> I'd be very grateful if anyone could point out my mistake(s).

Your signal is not a linear combination of frequencies between 100 and
150 Hz. If it were you would get something like this.

pro spec
time = (2.0/1000)*findgen(1001) ; time (s). NB 1001 samples in 2s
; so sampling freq is 500 Hz thus
; Nyquist freq is 250 Hz
i = complex(0,1)

freq1 = REPLICATE(100.0, 1001) ; single frequency #1
freq2 = REPLICATE(150.0, 1001) ; single frequency #2

theta1 = 2*!pi*freq1*time ; chirp phase angle
theta2 = 2*!pi*freq2*time ; chirp phase angle
signal = exp(i*theta1) + exp(i*theta2)

neg_freq_axis = reverse(-((250.0/500)*findgen(501)))
pos_freq_axis = ((250.0/499)*findgen(500)) + 1.0
freq_axis = [neg_freq_axis,pos_freq_axis] ; x-axis for plot

window,2,xsize=500,ysize=250
plot,freq_axis,alog10(shift(((abs(fft(signal)))^2),500)),$
xrange=[0,260],$
/xstyle,$
xticklen=1,$
xgridstyle=1,$
yticklen=1,$
ygridstyle=1

end

Even in this case you do not get perfect delta-function spikes in the
power spectrum due to finite signal length and sampling.

To construct your frequency-swept chirp, you have to use frequencies
over a larger range than the "pure" frequencies contained in your signal.

Ken Bowman
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Solving system of ODEs backwards in time?
Next Topic: create widget_label on the frame line

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 01:48:31 PDT 2025

Total time taken to generate the page: 0.64345 seconds