Jeff,
I am sure code is working fine. Some thing is wrong with memory, some variables
are overwriting and showing different values than expected which is causing a
peak at 512th samples. Don't know how to figure out what's going
on..
________________________________
From: Jeff Brower
To: BAS
Cc: c...
Sent: Friday, September 2, 2011 8:25 PM
Subject: Re: [c6x] Re: FFT Frequency Range
BAS-
> Sorry didn't have time to look over this problem
earlier..
>
> You were right, I encountered possiblity no. 3. Code is
> woring fine but that shows one strange spike at 512th sample
> that is out of my understanding. You can look the snapshot
>but I am trying to fix this problem.
>
> http://i55.tinypic.com/jpii69.jpg
Your spike at N/2 indicates a strong frequency component at Fs/2. For example
if you're sampling at 20 MHz then your
plot shows significant energy at 10 MHz. If you don't think that's
correct, then probably a coding or buffering
problem is still lingering.
One thing you might try is to feed your FFT all zeros and see if you still see
the spike. If not, then feed it a 1
followed by zeros, etc. Basically try some simple inputs for which you expect
specific output, and see what happens.
-Jeff
> ________________________________
> From: Jeff Brower
> To: BAS
> Cc: c...
> Sent: Sunday, August 14, 2011 11:19 PM
> Subject: Re: [c6x] Re: FFT Frequency Range
> Â
> BAS-
>
>> I know about aliasing.
>> If sampling frequency is 351.56 kHz, then the maximum frequency represented
in FFT is FS/2, or 175.78 kHz. Does it
>> mean that freq. resolution will be calculated using 175.78 kHz ?
>>
>> I have 1 kHz sine wave which is sampling at 351.56 kHz then I computed
512-point FFT. FFT magnitude shows peak at
>> 4th
>> sample which doesn't seem correct. If freq. resolution is 351.56 kHz/512
= 686.64 Hz then peak should appear at 2nd
>> sample (686.64*2 = 1373.28 Hz).
>>
>> Thats why I am wondering if discarding half of the FFT buffer should affect
the freq. resolution ? If not then why
>> peak is appearing at 4th sample ?
>
> 3 possibilities:
>
> 1) Your sine wave is 2 kHz, not 1 kHz.
>
> 2) Your sampling rate is 700 kHz, not 350 kHz.
>
> 3) Your code is messed up.
>
> My guess is #3. Suggest that you use CCS to capture a segment of your sampled
1 kHz sine wave and post as a .dat
> file, then people on the group can run MATLAB or other program to eliminate #1
and #2.
>
> -Jeff
Reply by Jeff Brower●September 2, 20112011-09-02
BAS-
> Sorry didn't have time to look over this problem
earlier..
>
> You were right, I encountered possiblity no. 3. Code is
> woring fine but that shows one strange spike at 512th sample
> that is out of my understanding. You can look the snapshot
>but I am trying to fix this problem.
>
> http://i55.tinypic.com/jpii69.jpg
Your spike at N/2 indicates a strong frequency component at Fs/2. For example
if you're sampling at 20 MHz then your
plot shows significant energy at 10 MHz. If you don't think that's
correct, then probably a coding or buffering
problem is still lingering.
One thing you might try is to feed your FFT all zeros and see if you still see
the spike. If not, then feed it a 1
followed by zeros, etc. Basically try some simple inputs for which you expect
specific output, and see what happens.
-Jeff
> ________________________________
> From: Jeff Brower
> To: BAS
> Cc: c...
> Sent: Sunday, August 14, 2011 11:19 PM
> Subject: Re: [c6x] Re: FFT Frequency Range
>
> BAS-
>
>> I know about aliasing.
>> If sampling frequency is 351.56 kHz, then the maximum frequency represented
in FFT is FS/2, or 175.78 kHz. Does it
>> mean that freq. resolution will be calculated using 175.78 kHz ?
>>
>> I have 1 kHz sine wave which is sampling at 351.56 kHz then I computed
512-point FFT. FFT magnitude shows peak at
>> 4th
>> sample which doesn't seem correct. If freq. resolution is 351.56 kHz/512
= 686.64 Hz then peak should appear at 2nd
>> sample (686.64*2 = 1373.28 Hz).
>>
>> Thats why I am wondering if discarding half of the FFT buffer should affect
the freq. resolution ? If not then why
>> peak is appearing at 4th sample ?
>
> 3 possibilities:
>
> 1) Your sine wave is 2 kHz, not 1 kHz.
>
> 2) Your sampling rate is 700 kHz, not 350 kHz.
>
> 3) Your code is messed up.
>
> My guess is #3. Suggest that you use CCS to capture a segment of your sampled
1 kHz sine wave and post as a .dat
> file, then people on the group can run MATLAB or other program to eliminate #1
and #2.
>
> -Jeff
_____________________________________
Reply by B S●September 2, 20112011-09-02
Jeff,
Sorry didn't have time to look over this problem earlier..
You were right, I encountered possiblity no. 3. Code is woring fine but that
shows one strange spike at 512th sample that is out of my understanding. You can
look the snapshot but I am trying to fix this problem.
________________________________
From: Jeff Brower
To: BAS
Cc: c...
Sent: Sunday, August 14, 2011 11:19 PM
Subject: Re: [c6x] Re: FFT Frequency Range
BAS-
> I know about aliasing.
> If sampling frequency is 351.56 kHz, then the maximum frequency represented
in FFT is FS/2, or 175.78 kHz. Does it
> mean that freq. resolution will be calculated using 175.78 kHz ?
>
> I have 1 kHz sine wave which is sampling at 351.56 kHz then I computed
512-point FFT. FFT magnitude shows peak at 4th
> sample which doesn't seem correct. If freq. resolution is 351.56 kHz/512
= 686.64 Hz then peak should appear at 2nd
> sample (686.64*2 = 1373.28 Hz).
>
> Thats why I am wondering if discarding half of the FFT buffer should affect
the freq. resolution ? If not then why
> peak is appearing at 4th sample ?
3 possibilities:
1) Your sine wave is 2 kHz, not 1 kHz.
2) Your sampling rate is 700 kHz, not 350 kHz.
3) Your code is messed up.
My guess is #3. Suggest that you use CCS to capture a segment of your sampled 1
kHz sine wave and post as a .dat
file, then people on the group can run MATLAB or other program to eliminate #1
and #2.
-Jeff
Reply by Jeff Brower●August 14, 20112011-08-14
BAS-
> I know about aliasing.
> If sampling frequency is 351.56 kHz, then the maximum frequency represented
in FFT is FS/2, or 175.78 kHz. Does it
> mean that freq. resolution will be calculated using 175.78 kHz ?
>
> I have 1 kHz sine wave which is sampling at 351.56 kHz then I computed
512-point FFT. FFT magnitude shows peak at 4th
> sample which doesn't seem correct. If freq. resolution is 351.56 kHz/512
= 686.64 Hz then peak should appear at 2nd
> sample (686.64*2 = 1373.28 Hz).
>
> Thats why I am wondering if discarding half of the FFT buffer should affect
the freq. resolution ? If not then why
> peak is appearing at 4th sample ?
3 possibilities:
1) Your sine wave is 2 kHz, not 1 kHz.
2) Your sampling rate is 700 kHz, not 350 kHz.
3) Your code is messed up.
My guess is #3. Suggest that you use CCS to capture a segment of your sampled 1
kHz sine wave and post as a .dat
file, then people on the group can run MATLAB or other program to eliminate #1
and #2.
-Jeff
_____________________________________
Reply by Andrew Nesterov●August 13, 20112011-08-13
B S,
Your formula for the Delta_F = Fs/N seem to be correct.
Since the signal frequency is not an even multiple of
Delta_F, your FFT might have missed it, instead you are
catching one of the sidelobes.
You might want to simulate a signal at 1373.28Hz and
look at the FFT data.
Rgds,
Andrew
> Subject: Re: FFT Frequency Range
> Posted by: "B S" m...@yahoo.com matlab_fft
> Date: Fri Aug 12, 2011 1:47 pm ((PDT))
>
> Uawideo,
>
> I know about aliasing.
> If sampling frequency is 351.56 kHz, then the maximum frequency represented
> in FFT is FS/2, or 175.78 kHz. Does it mean that freq. resolution will be
> calculated using 175.78 kHz ?
>
> I have 1 kHz sine wave which is sampling at 351.56 kHz then I computed
> 512-point FFT. FFT magnitude shows peak at 4th sample which doesn't seem
> correct. If freq. resolution is 351.56 kHz/512 = 686.64 Hz then peak should
> appear at 2nd sample (686.64*2 = 1373.28 Hz).
>
> Thats why I am wondering if discarding half of the FFT buffer should affect
> the freq. resolution ? If not then why peak is appearing at 4th sample ?
>
> I appreciate your help.
>
> BAS
_____________________________________
Reply by B S●August 12, 20112011-08-12
Uawideo,
I know about aliasing.
If sampling frequency is 351.56 kHz, then the maximum frequency represented in
FFT is FS/2, or 175.78 kHz. Does it mean that freq. resolution will be
calculated using 175.78 kHz ?
I have 1 kHz sine wave which is sampling at 351.56 kHz then I computed 512-point
FFT. FFT magnitude shows peak at 4th sample which doesn't seem correct. If
freq. resolution is 351.56 kHz/512 = 686.64 Hz then peak should appear at 2nd
sample (686.64*2 = 1373.28 Hz).
Thats why I am wondering if discarding half of the FFT buffer should affect the
freq. resolution ? If not then why peak is appearing at 4th sample ?
I appreciate your help.
BAS
________________________________
From: "u...@yahoo.com"
To: c...
Sent: Friday, August 12, 2011 5:31 AM
Subject: [c6x] Re: FFT Frequency Range
Aliasing can be avoided if the sample frequency is twice the frequency of
interest. So if you want a 0 to 10 Mhz signal you must sample at twiced or 20
Mega samples per second and depending on what you are doing with that data you
might have to go higher or lower your range.
Sent on the Sprint Now Network from my BlackBerry
I have one very simple question. I hope some one will clearify my doubts.
The
range of frequencies covered in the output record from the FFT is 0 to
1/2 the sample rate of the acquired data record. For example, a sample
rate of 20 MS/s (megasamples per second) would give an FFT range of 0 to
10 MHz.
Does it mean that I can only see proper FFT peak of the signal with maximum
frequency 5 MHz ?