Reply by Tim Wescott November 2, 20112011-11-02
On Fri, 28 Oct 2011 04:53:18 -0500, gpezzella wrote:

> @Wescott > Hi Tim, I have read your sampling.pdf article. It is the most clear > article on > > Antialiasing ever read. If you have other article please send me a link.
Thank you. Try these: http://www.wescottdesign.com/articles.html
> If I have understand good, I must remove frequency over Fsampling/2 > *before* > > acquire the signal and I must do it with analog filter. > > Since is pratically impossible have super high order low pass filter, is > better first > > improve the sampling rate frequency and if not was sufficient reduce a > cutoff > > frequency of the analog filter. > > In this mannery I avoid to introduce unexpected aliased energy into my > interested > > range of frequency.
Correct. Don't lose sight of the fact that you can sample fast with a really cheap analog filter, filter again in digital-land where it's easy to get precision filters, then decimate (re-sample) the resulting signal down to your final rate.
> Now I need suggest that come from real experience into real world. This > is my case: > > ******************************************************************* I > have a Microwave Sensor that detect human being presence (google > innosent ipm 65 > > and click on first result that will appeare). When human being is > detect, IPM 65 return in output frequency from 6Hz - 600Hz. > ******************************************************************* > > 1)Which kind od analog filter and which sample rate you suggest me? > 2)How many point (hence resolution or Bins like you say) I need? 3)What > I should check for see if human being was detect? Power, Amplitude, > Phase ??
You really haven't given enough information, so I'm going to reply with vague answers that will just raise more questions. 1: wide open, and fast. My knee-jerk reaction is to think that you should sample at least four times faster than your 600Hz maximum frequency, but if you anticipate modulation that's a significant fraction of your 600Hz, then -- faster. You really need to know the actual spectral content of the signal, and you need to know how you intend to decode the signal, before you can get a definitive answer. I very much doubt you'll need to go over 6kHz. 2: I don't think you want to do this with an FFT. The FFT is a small part of signal processing; I don't think it covers what you want to do here. 3: What changes the most distinctly?
> @Andrew > Thanks for your formula on Frequency_Resolution. Moreover I have check > my signal.It is a perfect sin(x) wave and effectively IMX() vector have > all zero value.
If it is a sine wave that is modulated either in frequency or amplitude, then when you consider it _with sidebands_ it won't have zero value. -- www.wescottdesign.com
Reply by Jerry Avins November 2, 20112011-11-02
On 10/28/2011 5:53 AM, gpezzella wrote:
> @Wescott > Hi Tim, I have read your sampling.pdf article. It is the most clear article > on > > Antialiasing ever read. If you have other article please send me a link. > > If I have understand good, I must remove frequency over Fsampling/2 > *before* acquire the signal and I must do it with analog filter.
Of course. The aliases mix with the wanted signal and there's no way to separate them.
> Since is pratically impossible have super high order low pass filter, is > better first improve the sampling rate frequency and if not was sufficient > reduce a cutoff frequency of the analog filter.
Oversample to the point where anti-aliasing becomes easier to accomplish. A numerical example: Maximum desired signal frequency ......................... 10 KHZ Minimum sampling frequency* .............................. 20 KHz Lowest frequency in the signal that can alias ........ 20.001 KHz Minimum allowable alias attenuation ...................... 40 dB Anti-alias filter requirement ............................. Ouch! OK. Let's try again: ______________________________ * Ignoring resolution time Maximum desired signal frequency ......................... 10 KHZ Sensible sampling frequency .............................. 30 KHz Lowest frequency in the signal that can alias ........ 20.001 KHz Minimum allowable alias attenuation ....................... 40 dB Anti-alias filter requirement ....................... Not so bad. Signals above 15 KHz will alias into the samples you get, but you can filter out anything above 10 KHz digitally, after sampling. Just above 15 KHz will have an alias at just below 15 KHz. 20 KHz will appear as an alias at 10 KHz, and your filter will have to attenuate the 20 KHz signal 40 dB relative to a signal at 10 KHz. That's doable, but not easy. Work out what you need if the sample rate is increased to 40 KHz. You will see that the analog filter will be much easier to build. How high must the sample rate be to allow a simple R-C to do the job? ... Jerry -- Engineering is the art of making what you want from things you can get.
Reply by gpezzella November 2, 20112011-11-02
Hi
could someone read my last post and check if i have understand good?
Thanks
Reply by gpezzella October 29, 20112011-10-29
Hi
no one have still reply my previous post?
Thanks 
Reply by gpezzella October 28, 20112011-10-28
@Wescott
Hi Tim, I have read your sampling.pdf article. It is the most clear article
on 

Antialiasing ever read. If you have other article please send me a link.

If I have understand good, I must remove frequency over Fsampling/2
*before* 

acquire the signal and I must do it with analog filter.

Since is pratically impossible have super high order low pass filter, is
better first 

improve the sampling rate frequency and if not was sufficient reduce a
cutoff 

frequency of the analog filter.

In this mannery I avoid to introduce unexpected aliased energy into my
interested 

range of frequency.

Now I need suggest that come from real experience into real world. This is
my case:

*******************************************************************
I have a Microwave Sensor that detect human being presence (google innosent
ipm 65 

and click on first result that will appeare). 
When human being is detect, IPM 65 return in output frequency
from 6Hz - 600Hz. 
*******************************************************************
    
1)Which kind od analog filter and which sample rate you suggest me?
2)How many point (hence resolution or Bins like you say) I need?
3)What I should check for see if human being was detect? Power, Amplitude,
Phase ?? 

@Andrew
Thanks for your formula on Frequency_Resolution.
Moreover I have check my signal.It is a perfect sin(x) wave and effectively
IMX() vector have all zero value.

Thanks
Reply by Tim Wescott October 27, 20112011-10-27
On Thu, 27 Oct 2011 08:59:34 -0500, gpezzella wrote:

> Hello > I should calculate a FFT of signal that have max 500Hz of frequency. > > I know that for avoid aliasing problem I must have a sample rate of > Fmax*2, so I have fix it to: > > Sample_Rate_Frequency= 1024Hz
Your proposed answer to Question 0 is incorrect. See http://www.wescottdesign.com/articles/Sampling/sampling.pdf for a discussion.
> > Question 1) > Is correct the follow table: > > [Acquisited Point] [Acquisition Duration] [Frequency Resolution] > 1024 1 sec 1Hz > 512 1/2 sec 2Hz > 256 1/4 sec 4Hz > 128 1/8 sec 8Hz
Well, the bins will be spaced apart by the frequencies that you're calling "frequency resolution". There's more to resolving signal frequencies than that, though.
> Question 2) > Suppose first previous case of 1024 Acquisited Point saved in IMX() and > REX()vectors. > Suppose I would calculate and plot the Power() = IMX()*IMX() + > REX()*REX() > > Is correct that Power vector must have the HALF SIZE of IMX()or REX()
No.
> For Index=1 to 512 > Power(Index) = IMX(Index)*IMX(Index) + REX(Index)*REX(Index) > Next > > Because the second half (513 - 1024) contain only an alias of signal?
DC (your index 1, I think) is unique, as is Fs/2. Sum _all_ the bins.
> Question 3) > If point 1 and 2 are correct, if I acquire only 128 point, calculate > power on 64, I have resolution of 8Hz??
No; see my comments on resolution. It ain't that easy. Specifically, you're going to have to window your data, which is going to smear out your spectrum somewhat. -- www.wescottdesign.com
Reply by Jerry Avins October 27, 20112011-10-27
On 10/27/2011 4:56 PM, gpezzella wrote:
> Hello, > I will try to explain what I would do..... > > > *************************************************************************** > My Case > *************************************************************************** > I have a Microwave Sensor that detect human being presence (google innosent > ipm 65 and click on first result that will appeare). > > When human being is detect, IPM 65 return in output frequency from 6Hz - > 600 Hz). When other things are detect, bird, car etc other frequency are > generate in output. > > I would check frequency between 6Hz - 600Hz, avoiding if possible analog > filter, for see where are peaks in this range. > > In this manner I could try to discriminate different case: human, dogs > etc. > *************************************************************************** > > > > > > *************************************************************************** > Theory > *************************************************************************** > > I try to repost the question in different way. > > Suppose to sample the output of Innosent IPM 65 after the amplify filter > showed in fig3 of datasheet (6-600 Hz with 60dB gain) > > Suppose to have FIXED SAMPLING RATE = 1024 Hz > Suppose to perform 4 different acquisition > > 1) Aquisition = 1024 Points > 2) Aquisition = 512 Points > 3) Aquisition = 256 Points > 4) Aquisition = 128 Points > > [Acquisited Point] [Acquisition Duration] [Frequency Resolution] > 1) 1024 1 sec ? > 2) 512 1/2 sec ? > 3) 256 1/4 sec ? > 4) 128 1/8 sec ? > > 1) Which is the resolution of every acquistion? > (Plase fill the resolution field)
You had it right the first time. I wasn't sure I understood.
> After every acquisiton I calculate FFT that return me 2 vectors: REX() and > IMX() > > 2) Is the lenght of this 2 vectors equal at number of points acquisited?
The length of each of them. For N points into the FFT, there are N complex numbers out.
> 3) If I calculate the power OUT()= IMX()*IMX()+ REX()*REX() is the lenght > of vector OUT() equal at number of acquisited points? > > 4) Which range of points of the vector OUT()I should plot for be sure to > show theoretically correct information? > > [Acquisited Point] [Acquisition Duration] [Range] > 1) 1024 1 sec ? > 2) 512 1/2 sec ? > 3) 256 1/4 sec ? > 4) 128 1/8 sec ? > > (Plase fill the range field)
[Acquired Point] [Acquisition Duration] [Range] 1) 1024 1 sec 1024 2) 512 1/2 sec 512 3) 256 1/4 sec 256 4) 128 1/8 sec 128 The validity of result depends on the absence of all frequencies greater than half the sampling frequency *before* the sampling takes place. Let me know if I missed anything. Jerry -- Engineering is the art of making what you want from things you can get.
Reply by gpezzella October 27, 20112011-10-27
Hello,
I will try to explain what I would do.....


***************************************************************************
My Case
***************************************************************************
I have a Microwave Sensor that detect human being presence (google innosent
ipm 65 and click on first result that will appeare).

When human being is detect, IPM 65 return in output frequency from 6Hz -
600 Hz). When other things are detect, bird, car etc other frequency are
generate in output.

I would check frequency between 6Hz - 600Hz, avoiding if possible analog
filter, for see where are peaks in this range. 

In this manner I could try to discriminate different case: human, dogs
etc.
***************************************************************************





***************************************************************************
Theory
***************************************************************************

I try to repost the question in different way.

Suppose to sample the output of Innosent IPM 65 after the amplify filter
showed in fig3 of datasheet (6-600 Hz with 60dB gain)
  
Suppose to have FIXED SAMPLING RATE = 1024 Hz
Suppose to perform 4 different acquisition

1) Aquisition = 1024 Points
2) Aquisition =  512 Points
3) Aquisition =  256 Points
4) Aquisition =  128 Points

[Acquisited Point]  [Acquisition Duration]  [Frequency Resolution]
1)      1024                 1 sec                     ?
2)       512                 1/2 sec                   ?
3)       256                 1/4 sec                   ?
4)       128                 1/8 sec                   ?

1) Which is the resolution of every acquistion? 
(Plase fill the resolution field) 


After every acquisiton I calculate FFT that return me 2 vectors: REX() and
IMX()

2) Is the lenght of this 2 vectors equal at number of points acquisited?  

3) If I calculate the power OUT()= IMX()*IMX()+ REX()*REX() is the lenght
of vector OUT() equal at number of acquisited points?  

4) Which range of points of the vector OUT()I should plot for be sure to
show theoretically correct information? 
 
[Acquisited Point]  [Acquisition Duration]          [Range]
1)      1024                 1 sec                     ?
2)       512                 1/2 sec                   ?
3)       256                 1/4 sec                   ?
4)       128                 1/8 sec                   ?

                   (Plase fill the range field) 

Please reply point to point having GREAT PATIENCE :-)
Thanks in advice



Reply by Andrew Holme October 27, 20112011-10-27
"gpezzella" <gpezzella@n_o_s_p_a_m.yahoo.com> wrote in message 
news:nNKdnSVjGf1b_jTTnZ2dnUVZ_t2dnZ2d@giganews.com...
> Hello > I should calculate a FFT of signal that have max 500Hz of frequency. > > I know that for avoid aliasing problem I must have a sample rate of > Fmax*2, > so I have fix it to: > > Sample_Rate_Frequency= 1024Hz > > Question 1) > Is correct the follow table: > > [Acquisited Point] [Acquisition Duration] [Frequency Resolution] > 1024 1 sec 1Hz > 512 1/2 sec 2Hz > 256 1/4 sec 4Hz > 128 1/8 sec 8Hz
Yes. FFT Length = Number_of_samples / Sampling_rate Frequency_resolution = 1 / Length You certainly can't see a pattern repeating at 1 cycle per second if you have less 1 second of data!
> > > Question 2) > Suppose first previous case of 1024 Acquisited Point saved in IMX() and > REX()vectors. > Suppose I would calculate and plot the Power() = IMX()*IMX() + REX()*REX() > > Is correct that Power vector must have the HALF SIZE of IMX()or REX() > > For Index=1 to 512 > Power(Index) = IMX(Index)*IMX(Index) + REX(Index)*REX(Index) > Next > > Because the second half (513 - 1024) contain only an alias of signal?
This happens when the input data are purely real i.e. input imaginary parts are all zero. Actually, if you look at the imaginary output data, you will see that IMX(1024-i) = - IMX(i) but this is masked by squaring. It is different when the input data is complex.
> > > Question 3) > If point 1 and 2 are correct, if I acquire only 128 point, calculate power > on 64, I have resolution of 8Hz?? > > Thanks in advice > > >
FFT Length = 128 / 1024 1 / Length = 1024 / 128 = 8 Hz Bin 0 = DC Bin 1 = 8 Hz Bin 2 = 16 Hz Bin 3 = 24 Hz . . . Bin 61 = 488 Hz Bin 62 = 496 Hz Bin 63 = 504 Hz which is just under fs / 2
Reply by Jerry Avins October 27, 20112011-10-27
On 10/27/2011 12:00 PM, gpezzella wrote:
>> The aliasing problem is not so simple: you need an analog filter >> before sampling. The filter must attenuate the alias frequencies >> so that the remaining energy is negligible in your application. >> >> If you have a signal bandwidth of 500 Hz, you're specifying a >> nearly impossible anti-alias analog filter with 1024 Hz sampling >> rate. The alias frequency of 500 Hz will then be at 524 Hz, so >> you're specifying a filter with null attenuation at 500 Hz and >> very high attenuation at 524 Hz. > > Why analog? > > Supponing that I will use it, could you reply my 3 questions?
OK. > Question 1) > Is correct the follow table: > > [Acquisited Point] [Acquisition Duration] [Frequency Resolution] > 1024 1 sec 1Hz > 512 1/2 sec 2Hz > 256 1/4 sec 4Hz > 128 1/8 sec 8Hz Probably not. I'm not sure that I understand it. > Question 2) > Suppose first previous case of 1024 Acquisited Point saved in IMX() > and REX()vectors. > Suppose I would calculate and plot the Power() = IMX()*IMX() + > REX()*REX() > > Is correct that Power vector must have the HALF SIZE of IMX()or REX() > > For Index=1 to 512 > Power(Index) = IMX(Index)*IMX(Index) + REX(Index)*REX(Index) > Next > > Because the second half (513 - 1024) contain only an alias of signal? What second half? The FFT yields as many bins as the number of samples allows. If you sample for 10 seconds, you will have 10240 samples, with a resolution of 0.1 Hz *at all frequencies up to fs/2*. > Question 3) > If point 1 and 2 are correct, if I acquire only 128 point, calculate > power on 64, I have resolution of 8Hz?? It's not correct. Jerry P.S. Tauno is right. You won't be able to make an effective anti-alias filter. -- Engineering is the art of making what you want from things you can get.