Reply by Jim Shima March 29, 20022002-03-29

If you are looking to estimate the frequency of several sinusoids, I would
suggest you look at a spectral estimation text. You can do one of several
AR
algorithms to get the freq of the sinusoid in each band. I would suggest
doing prony's
method, which will give you the exact freq. of a noiseless sinusoid.

-----Original Message-----
From: Bhooshan iyer [mailto:]
Sent: Friday, March 29, 2002 10:59 AM
To: ; ;
Cc: ; ; ;
; ;
Subject: RE: [matlab] IIR filtering Doubt...
Hi Guys,
I did a lot of thinking(studying?!) today on the problem and

after 24 hrs, i stand wiser (understood my requirements much more

clearly!!!) and hence i think i have to restate the problem and then

ill tell you all the conclusions ive reached and pls comment on my

conclusions... To begin with, what i want to do is spectral analysis/estimation of my
signal! i have a composite signal of whose charactaristics iam very well aware

of (it contains 3 bands as i had said in my earlier mail)

In analog parlance, what i want to do to this signal is that, i want to

input the signal into a spectrum analyser and measure it's magnitude

and frequency!thats it!
what i want to measure on these filtered signals are their magnitudes

and a resonablky good estimate of their frequencies and IAM NOT AT ALL

interested in their phase response... so, i was led to believe that FFT is the digital world's answer to

spectrum analyser of the analog world!!(believe me, its a very very

expensive answer!!!)

so i thought i would take my signal, sample it at 300 hz( remember my

maximum frequency is not more than 68 hz, so my sampling frequency is

more than 3 times and i thought wow! my work is done!!!) and perform

FFT on them, to get the spectra!!! but nobody told me anything about

something called spectral leakage!!!!

the thing about this method is that, my frequency resolution if it is

say, 1hz, then what happens is if i have a frequency at 30.5hz( which

lies between 30 and 31), i will actually have a mis reported peak at

somewhere around 31 or 30hz, which is not a major problem but what also

happens is that my amplitude value also gets distorted, which is highly

unacceptable for me!!! so, if i have to offset that then i will have to

increase my frequency resolution to a great extent and after doing some

ball-park work, i found out that if i dont want a major error in

magnitude measurement then i will need to have a frequency resolution

of 0.01hz and that implies then i will have to sample the signal at

around 30,000 samples/sec. Then my FFT algorithm may not have the time

to preform FFT on set of samples before the next set arrives!!!!

iam still not sure about these metrics and i cant rule out with

absolute certainity that FFT cant performed in time, but i know this

much that i have ONLY AROUND 4 THOUSANDS with me to perform whatever

tricks i want to perform, including before the next set of samples

arrive( my processor isaa 30mhz lf2407)... which sounds a lill tricky

to me, i dunno i may be wrong but i have a feeling that this is too

much for the processor to handle!!! so, the alternate approach i thought of was that i have to filter my

signal with three band-pass filters, get three frequencies at output

which are pure in nature and dont have any spurious frequencies in

them, so now all i have to do is develop an algorithm to somehow

estimate what frequency they are of and what is their magnitude...
the algorithm i thought of was that... i will need 4 arrays- one to store my input sampled signal, the other 3

to store my 3 different frequencies 1] on the input buffer perform 3 band pass filter

2] store the samples of the 3 different frequencies in three different
buffers

3]calculate the maxima and minima on each of the buffers to estimate their
frequency and magnitude

4]arrays keep growing and the process continues... i would like to belive that much like, when i rapidly rotate the volume

knob back and forth in a music system the led/lcd display rapidly

flashes the volume level which is flickering... i want the same effect

with the magnitude but lill errors are also allowed...

I mean, how does this all sound? does it sound crazy or is it feasible?

and i havent even talked about implementational issues yet!!! Can 2407 handle this? am i re-inventing the wheel? or is there a standard
solution for this problem?

is this what stft exactly does?( havent gone thru' this sliding time fourier

transform yet!!)

Now, my gurus , what are your thoughts?

expectinng eagerly for your replies....

have i explained the whole thing well enuff? Regards,
Bhooshan

>Hi everybody,
>
>Iam trying to do a filtering on a certain
>signal,lets
>
>say a sine wave consisting of three different
>frequency ranges ie,
>
>in real time my signal could consist of any 3
>frequencies of the
>
>folllowing nature-
>
>1] any one particular frequency in the range of
>19-31hz
>2] any one particular frequency in the range of
>38-62hz
>3]any one particular frequency in the range of
>9.5-16.5hz
>
>(So,the maximum frequency is not more than 100hz...)
>
>like, say 25hz,40hz and 12hz
>
>and the next time it could be 30hz,50hz, 10hz >so now, i want to design a passband iir elliptical
>filter to pass
>
>the 3 frequencies which will fall in these 3 ranges,
>but then my
>
>doubt is should i design 3 diffrent filters? or,is
>there anyway i
>
>can design a single passband filter which will take
>care of thise
>
>condition. The problem i face is that if design a
>pass-band filter of
>
>range 8hz-80hz(which covers all the 3 ranges i
>mentioned above...),
>
>then there is a chance it will then pass the
>frequencies say, 18hz
>
>and 32hz, if in case they are present!!! but then,
>thats an
>
>undesirable result for me... >
>
>because as i see it, if
>
>i design a single filter of say, passband 5-60 hz
>then a frequency 32
>
>might also get passed , which is unwanted for me...
>so what is the
>
>solution for such problems? has anybody faced such
>situtation before?
>
>any solutions on this? if i have to design 3
>different filters, then
>
>how exactly to do it?
>
>can matlab help me to solve this problem? if so,
>how?
>
>the processor iam interested in implementing this
>tms320lf2407. >regards,
>bhooshan >
>


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

_____________________________________
Note: If you do a simple "reply" with your email client, only the author of
this message will receive your answer. You need to do a "reply all" if you
want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:

To Post:

To Leave:

Archives: http://www.yahoogroups.com/group/matlab

More DSP-Related Groups: http://www.dsprelated.com/groups.php3

">http://docs.yahoo.com/info/terms/


Reply by Bhooshan iyer March 29, 20022002-03-29

Hi Guys,
I did a lot of thinking(studying?!) today on the problem and

after 24 hrs, i stand wiser (understood my requirements much more

clearly!!!) and hence i think i have to restate the problem and then

ill tell you all the conclusions ive reached and pls comment on my

conclusions... To begin with, what i want to do is spectral analysis/estimation of my
signal! i have a composite signal of whose charactaristics iam very well aware

of (it contains 3 bands as i had said in my earlier mail)

In analog parlance, what i want to do to this signal is that, i want to

input the signal into a spectrum analyser and measure it's magnitude

and frequency!thats it!
what i want to measure on these filtered signals are their magnitudes

and a resonablky good estimate of their frequencies and IAM NOT AT ALL

interested in their phase response... so, i was led to believe that FFT is the digital world's answer to

spectrum analyser of the analog world!!(believe me, its a very very

expensive answer!!!)

so i thought i would take my signal, sample it at 300 hz( remember my

maximum frequency is not more than 68 hz, so my sampling frequency is

more than 3 times and i thought wow! my work is done!!!) and perform

FFT on them, to get the spectra!!! but nobody told me anything about

something called spectral leakage!!!!

the thing about this method is that, my frequency resolution if it is

say, 1hz, then what happens is if i have a frequency at 30.5hz( which

lies between 30 and 31), i will actually have a mis reported peak at

somewhere around 31 or 30hz, which is not a major problem but what also

happens is that my amplitude value also gets distorted, which is highly

unacceptable for me!!! so, if i have to offset that then i will have to

increase my frequency resolution to a great extent and after doing some

ball-park work, i found out that if i dont want a major error in

magnitude measurement then i will need to have a frequency resolution

of 0.01hz and that implies then i will have to sample the signal at

around 30,000 samples/sec. Then my FFT algorithm may not have the time

to preform FFT on set of samples before the next set arrives!!!!

iam still not sure about these metrics and i cant rule out with

absolute certainity that FFT cant performed in time, but i know this

much that i have ONLY AROUND 4 THOUSANDS with me to perform whatever

tricks i want to perform, including before the next set of samples

arrive( my processor isaa 30mhz lf2407)... which sounds a lill tricky

to me, i dunno i may be wrong but i have a feeling that this is too

much for the processor to handle!!! so, the alternate approach i thought of was that i have to filter my

signal with three band-pass filters, get three frequencies at output

which are pure in nature and dont have any spurious frequencies in

them, so now all i have to do is develop an algorithm to somehow

estimate what frequency they are of and what is their magnitude...
the algorithm i thought of was that... i will need 4 arrays- one to store my input sampled signal, the other 3

to store my 3 different frequencies 1] on the input buffer perform 3 band pass filter

2] store the samples of the 3 different frequencies in three different
buffers

3]calculate the maxima and minima on each of the buffers to estimate their
frequency and magnitude

4]arrays keep growing and the process continues... i would like to belive that much like, when i rapidly rotate the volume

knob back and forth in a music system the led/lcd display rapidly

flashes the volume level which is flickering... i want the same effect

with the magnitude but lill errors are also allowed...

I mean, how does this all sound? does it sound crazy or is it feasible?

and i havent even talked about implementational issues yet!!! Can 2407 handle this? am i re-inventing the wheel? or is there a standard
solution for this problem?

is this what stft exactly does?( havent gone thru' this sliding time fourier
transform yet!!)

Now, my gurus , what are your thoughts?

expectinng eagerly for your replies....

have i explained the whole thing well enuff? Regards,
Bhooshan

>Hi everybody,
>
>Iam trying to do a filtering on a certain
>signal,lets
>
>say a sine wave consisting of three different
>frequency ranges ie,
>
>in real time my signal could consist of any 3
>frequencies of the
>
>folllowing nature-
>
>1] any one particular frequency in the range of
>19-31hz
>2] any one particular frequency in the range of
>38-62hz
>3]any one particular frequency in the range of
>9.5-16.5hz
>
>(So,the maximum frequency is not more than 100hz...)
>
>like, say 25hz,40hz and 12hz
>
>and the next time it could be 30hz,50hz, 10hz >so now, i want to design a passband iir elliptical
>filter to pass
>
>the 3 frequencies which will fall in these 3 ranges,
>but then my
>
>doubt is should i design 3 diffrent filters? or,is
>there anyway i
>
>can design a single passband filter which will take
>care of thise
>
>condition. The problem i face is that if design a
>pass-band filter of
>
>range 8hz-80hz(which covers all the 3 ranges i
>mentioned above...),
>
>then there is a chance it will then pass the
>frequencies say, 18hz
>
>and 32hz, if in case they are present!!! but then,
>thats an
>
>undesirable result for me... >
>
>because as i see it, if
>
>i design a single filter of say, passband 5-60 hz
>then a frequency 32
>
>might also get passed , which is unwanted for me...
>so what is the
>
>solution for such problems? has anybody faced such
>situtation before?
>
>any solutions on this? if i have to design 3
>different filters, then
>
>how exactly to do it?
>
>can matlab help me to solve this problem? if so,
>how?
>
>the processor iam interested in implementing this
>tms320lf2407. >regards,
>bhooshan >
>


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


Reply by March 29, 20022002-03-29
Hi;

I think you can give the parameters like this:
say your sampling frequemcy is 150 Hz
and half of your sampling frequency is 75 Hz

then your frequency parameters for your filter will be
[0 9.5/75-0.01 9.5/75 16.5/75 16.5/75+0.01 19/75-0.01
19/75 31/75 31/75+0.01 38/75-0.01 38/75 62/75
62/75+0.01 1]
and your magnitude values will be
[0 0 1 1 0 0 1 1 0 0 1 1 0 0]

so you will have three bands

--- bhooshaniyer <> wrote: > Hi everybody,
>
> Iam trying to do a filtering on a certain
> signal,lets
>
> say a sine wave consisting of three different
> frequency ranges ie,
>
> in real time my signal could consist of any 3
> frequencies of the
>
> folllowing nature-
>
> 1] any one particular frequency in the range of
> 19-31hz
> 2] any one particular frequency in the range of
> 38-62hz
> 3]any one particular frequency in the range of
> 9.5-16.5hz
>
> (So,the maximum frequency is not more than 100hz...)
>
> like, say 25hz,40hz and 12hz
>
> and the next time it could be 30hz,50hz, 10hz > so now, i want to design a passband iir elliptical
> filter to pass
>
> the 3 frequencies which will fall in these 3 ranges,
> but then my
>
> doubt is should i design 3 diffrent filters? or,is
> there anyway i
>
> can design a single passband filter which will take
> care of thise
>
> condition. The problem i face is that if design a
> pass-band filter of
>
> range 8hz-80hz(which covers all the 3 ranges i
> mentioned above...),
>
> then there is a chance it will then pass the
> frequencies say, 18hz
>
> and 32hz, if in case they are present!!! but then,
> thats an
>
> undesirable result for me... >
>
> because as i see it, if
>
> i design a single filter of say, passband 5-60 hz
> then a frequency 32
>
> might also get passed , which is unwanted for me...
> so what is the
>
> solution for such problems? has anybody faced such
> situtation before?
>
> any solutions on this? if i have to design 3
> different filters, then
>
> how exactly to do it?
>
> can matlab help me to solve this problem? if so,
> how?
>
> the processor iam interested in implementing this
> tms320lf2407. > regards,
> bhooshan >
>


__________________________________________________


Reply by Egler, Mark March 29, 20022002-03-29
But doesn't a comb filter pass frequencies at F, 2F, 3F, 4F etc., not F, 2F,
4F, 8F as required for octave separation?

> -----Original Message-----
> From: poochix [mailto:]
> Sent: Thu, March 28, 2002 10:43 PM
> To: ; bhooshaniyer
> Subject: Re: [matlab] IIR filtering Doubt... > You seem to be having passbands that are octaves apart. May
> be you can
> design a comb filter, or rather 1 - comb so that you have
> notches at the
> right places
>
> Poochix
> ----- Original Message -----
> From: "bhooshaniyer" <>
> To: <>
> Sent: Thursday, March 28, 2002 12:15 PM
> Subject: [matlab] IIR filtering Doubt... > > Hi everybody,
> >
> > Iam trying to do a filtering on a certain signal,lets
> >
> > say a sine wave consisting of three different frequency ranges ie,
> >
> > in real time my signal could consist of any 3 frequencies of the
> >
> > folllowing nature-
> >
> > 1] any one particular frequency in the range of 19-31hz
> > 2] any one particular frequency in the range of 38-62hz
> > 3]any one particular frequency in the range of 9.5-16.5hz
> >
> > (So,the maximum frequency is not more than 100hz...)
> >
> > like, say 25hz,40hz and 12hz
> >
> > and the next time it could be 30hz,50hz, 10hz
> >
> >
> > so now, i want to design a passband iir elliptical filter to pass
> >
> > the 3 frequencies which will fall in these 3 ranges, but then my
> >
> > doubt is should i design 3 diffrent filters? or,is there anyway i
> >
> > can design a single passband filter which will take care of thise
> >
> > condition. The problem i face is that if design a pass-band
> filter of
> >
> > range 8hz-80hz(which covers all the 3 ranges i mentioned above...),
> >
> > then there is a chance it will then pass the frequencies say, 18hz
> >
> > and 32hz, if in case they are present!!! but then, thats an
> >
> > undesirable result for me...
> >
> >
> >
> >
> > because as i see it, if
> >
> > i design a single filter of say, passband 5-60 hz then a
> frequency 32
> >
> > might also get passed , which is unwanted for me... so what is the
> >
> > solution for such problems? has anybody faced such
> situtation before?
> >
> > any solutions on this? if i have to design 3 different filters, then
> >
> > how exactly to do it?
> >
> > can matlab help me to solve this problem? if so, how?
> >
> > the processor iam interested in implementing this tms320lf2407.
> >
> >
> > regards,
> > bhooshan
> >
> >
> >
> >
> >
> > _____________________________________
> > Note: If you do a simple "reply" with your email client,
> only the author
> of this message will receive your answer. You need to do a
> "reply all" if
> you want your answer to be distributed to the entire group.
> >
> > _____________________________________
> > About this discussion group:
> >
> > To Join:
> >
> > To Post:
> >
> > To Leave:
> >
> > Archives: http://www.yahoogroups.com/group/matlab
> >
> > More DSP-Related Groups: http://www.dsprelated.com/groups.php3
> >
> > ">http://docs.yahoo.com/info/terms/
> > _________________________________________________________
> >
> ------------------------ Yahoo! Groups Sponsor
> ---------------------~-->
> Buy Stock for $4.
> No Minimums.
> FREE Money 2002.
> http://us.click.yahoo.com/BgmYkB/VovDAA/ySSFAA/wHYolB/TM
> --------------------------
> -------~->
>
> _____________________________________
> Note: If you do a simple "reply" with your email client, only
> the author of this message will receive your answer. You
> need to do a "reply all" if you want your answer to be
> distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join:
>
> To Post:
>
> To Leave:
>
> Archives: http://www.yahoogroups.com/group/matlab
>
> More DSP-Related Groups: http://www.dsprelated.com/groups.php3
>
> ">http://docs.yahoo.com/info/terms/



Reply by poochix March 29, 20022002-03-29
You seem to be having passbands that are octaves apart. May be you can
design a comb filter, or rather 1 - comb so that you have notches at the
right places

Poochix
----- Original Message -----
From: "bhooshaniyer" <>
To: <>
Sent: Thursday, March 28, 2002 12:15 PM
Subject: [matlab] IIR filtering Doubt... > Hi everybody,
>
> Iam trying to do a filtering on a certain signal,lets
>
> say a sine wave consisting of three different frequency ranges ie,
>
> in real time my signal could consist of any 3 frequencies of the
>
> folllowing nature-
>
> 1] any one particular frequency in the range of 19-31hz
> 2] any one particular frequency in the range of 38-62hz
> 3]any one particular frequency in the range of 9.5-16.5hz
>
> (So,the maximum frequency is not more than 100hz...)
>
> like, say 25hz,40hz and 12hz
>
> and the next time it could be 30hz,50hz, 10hz > so now, i want to design a passband iir elliptical filter to pass
>
> the 3 frequencies which will fall in these 3 ranges, but then my
>
> doubt is should i design 3 diffrent filters? or,is there anyway i
>
> can design a single passband filter which will take care of thise
>
> condition. The problem i face is that if design a pass-band filter of
>
> range 8hz-80hz(which covers all the 3 ranges i mentioned above...),
>
> then there is a chance it will then pass the frequencies say, 18hz
>
> and 32hz, if in case they are present!!! but then, thats an
>
> undesirable result for me... >
>
> because as i see it, if
>
> i design a single filter of say, passband 5-60 hz then a frequency 32
>
> might also get passed , which is unwanted for me... so what is the
>
> solution for such problems? has anybody faced such situtation before?
>
> any solutions on this? if i have to design 3 different filters, then
>
> how exactly to do it?
>
> can matlab help me to solve this problem? if so, how?
>
> the processor iam interested in implementing this tms320lf2407. > regards,
> bhooshan > _____________________________________
> Note: If you do a simple "reply" with your email client, only the author
of this message will receive your answer. You need to do a "reply all" if
you want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join:
>
> To Post:
>
> To Leave:
>
> Archives: http://www.yahoogroups.com/group/matlab
>
> More DSP-Related Groups: http://www.dsprelated.com/groups.php3
>
> ">http://docs.yahoo.com/info/terms/
>


_________________________________________________________



Reply by bhooshaniyer March 28, 20022002-03-28
Hi everybody,

Iam trying to do a filtering on a certain signal,lets

say a sine wave consisting of three different frequency ranges ie,

in real time my signal could consist of any 3 frequencies of the

folllowing nature-

1] any one particular frequency in the range of 19-31hz
2] any one particular frequency in the range of 38-62hz
3]any one particular frequency in the range of 9.5-16.5hz

(So,the maximum frequency is not more than 100hz...)

like, say 25hz,40hz and 12hz

and the next time it could be 30hz,50hz, 10hz so now, i want to design a passband iir elliptical filter to pass

the 3 frequencies which will fall in these 3 ranges, but then my

doubt is should i design 3 diffrent filters? or,is there anyway i

can design a single passband filter which will take care of thise

condition. The problem i face is that if design a pass-band filter of

range 8hz-80hz(which covers all the 3 ranges i mentioned above...),

then there is a chance it will then pass the frequencies say, 18hz

and 32hz, if in case they are present!!! but then, thats an

undesirable result for me...

because as i see it, if

i design a single filter of say, passband 5-60 hz then a frequency 32

might also get passed , which is unwanted for me... so what is the

solution for such problems? has anybody faced such situtation before?

any solutions on this? if i have to design 3 different filters, then

how exactly to do it?

can matlab help me to solve this problem? if so, how?

the processor iam interested in implementing this tms320lf2407. regards,
bhooshan