Re: FFT confusion [message #35151] |
Mon, 19 May 2003 08:46  |
jefield
Messages: 3 Registered: January 2003
|
Junior Member |
|
|
Kenneth Bowman <k-bowman@null.tamu.edu> wrote in message news:<k-bowman-FF6825.10385215052003@news.tamu.edu>...
> 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
Thank you very much for your help.
Best wishes,
Julian
|
|
|
Re: FFT confusion [message #35212 is a reply to message #35151] |
Thu, 15 May 2003 08:38   |
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
|
|
|
Re: FFT confusion [message #94654 is a reply to message #35151] |
Sat, 05 August 2017 15:13   |
kapoorconsciousness
Messages: 2 Registered: August 2017
|
Junior Member |
|
|
Same issue, this chirp peaks at omega0 and omega0 + 2 * chirprate rather then just omega0 + chirprate, have you figured it out why yet?
On Monday, May 19, 2003 at 5:46:19 PM UTC+2, Julian Field wrote:
> Kenneth Bowman <k-bowman@null.tamu.edu> wrote in message news:<k-bowman-FF6825.10385215052003@news.tamu.edu>...
>> 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
>
> Thank you very much for your help.
>
> Best wishes,
>
> Julian
|
|
|
Re: FFT confusion [message #94655 is a reply to message #35151] |
Sat, 05 August 2017 15:59  |
kapoorconsciousness
Messages: 2 Registered: August 2017
|
Junior Member |
|
|
Solved, you we missing taking into account the deltat of your data into making the chirp signal. The code below would work:
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
;;; so your deltat = 2, aha!
deltat = 2;
freq = 100.0 + (50.0/1000)*findgen(1001)/deltat ; chirp frequency array
theta = 2*!pi*freq*time ; chirp phase angle
i = complex(0,1)
signal = exp(i*theta)
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
set_plot, "x";
end
On Monday, May 19, 2003 at 5:46:19 PM UTC+2, Julian Field wrote:
> Kenneth Bowman <k-bowman@null.tamu.edu> wrote in message news:<k-bowman-FF6825.10385215052003@news.tamu.edu>...
>> 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
>
> Thank you very much for your help.
>
> Best wishes,
>
> Julian
|
|
|