DSPRelated.com
Forums

Computing Moving Average filter's coefficients

Started by Flashman January 5, 2009
Hello everyone, 

first, please excuse me for spelling or grammer mistakes. 

I was asked to estimate ,with Matlab, an MA filter's (FIR filter)
coefficients only from 10,000 output data samples (y(t)) which I've been
given on a DAT file.

The filter is a 3rd order filter, so i need to compute b0, b1, b2, b3
coefficients. The input signal x(t) is a white gaussian noise:   
x= rand(1,10000)

now, if I had b0-b3 and had to compute the output y(t), Matlab's filter
function can solve it easily. 
but I don't have a clue how can I estimate b0-b3 from y(t).

can someone please help?

Thanks in advance, 
Flashman.



On Jan 5, 7:28&#4294967295;am, "Flashman" <ya...@doar.afeka.ac.il> wrote:
> Hello everyone, > > first, please excuse me for spelling or grammer mistakes. > > I was asked to estimate ,with Matlab, an MA filter's (FIR filter) > coefficients only from 10,000 output data samples (y(t)) which I've been > given on a DAT file. > > The filter is a 3rd order filter, so i need to compute b0, b1, b2, b3 > coefficients. The input signal x(t) is a white gaussian noise: &#4294967295; > x= rand(1,10000) > > now, if I had b0-b3 and had to compute the output y(t), Matlab's filter > function can solve it easily. > but I don't have a clue how can I estimate b0-b3 from y(t). > > can someone please help? > > Thanks in advance, > Flashman.
help tfestimate

Flashman wrote:
> > Hello everyone, > > first, please excuse me for spelling or grammer mistakes. > > I was asked to estimate ,with Matlab, an MA filter's (FIR filter) > coefficients only from 10,000 output data samples (y(t)) which I've been > given on a DAT file. > > The filter is a 3rd order filter, so i need to compute b0, b1, b2, b3 > coefficients. The input signal x(t) is a white gaussian noise: > x= rand(1,10000) > > now, if I had b0-b3 and had to compute the output y(t), Matlab's filter > function can solve it easily. > but I don't have a clue how can I estimate b0-b3 from y(t).
Maybe I don't understand the question. If it is a moving average filter with 4 coefficients, it looks like a[1 1 1 1] where a is some constant factor of gain. If you are asking how to determine what a is by looking only at the output - I don't think you can. -jim
> > can someone please help? > > Thanks in advance, > Flashman.
On Jan 5, 12:57&#4294967295;pm, jim <".sjedgingN0sp"@m...@mwt.net> wrote:
> Flashman wrote: > > > Hello everyone, > > > first, please excuse me for spelling or grammer mistakes. > > > I was asked to estimate ,with Matlab, an MA filter's (FIR filter) > > coefficients only from 10,000 output data samples (y(t)) which I've been > > given on a DAT file. > > > The filter is a 3rd order filter, so i need to compute b0, b1, b2, b3 > > coefficients. The input signal x(t) is a white gaussian noise: > > x= rand(1,10000) > > > now, if I had b0-b3 and had to compute the output y(t), Matlab's filter > > function can solve it easily. > > but I don't have a clue how can I estimate b0-b3 from y(t). > > Maybe I don't understand the question. If it is a moving average filter with 4 > coefficients, it looks like a[1 1 1 1] where a is some constant factor of gain. > If you are asking how to determine what a is by looking only at the output - I > don't think you can.
In statistics, the term "moving average" is much more general. See e.g. http://en.wikipedia.org/wiki/Moving_average_model or http://en.wikipedia.org/wiki/Autoregressive_moving_average_model. -- Oli
On Jan 5, 6:28&#4294967295;am, "Flashman" <ya...@doar.afeka.ac.il> wrote:
> Hello everyone, > > first, please excuse me for spelling or grammer mistakes. > > I was asked to estimate ,with Matlab, an MA filter's (FIR filter) > coefficients only from 10,000 output data samples (y(t)) which I've been > given on a DAT file. > > The filter is a 3rd order filter, so i need to compute b0, b1, b2, b3 > coefficients. The input signal x(t) is a white gaussian noise: &#4294967295; > x= rand(1,10000) > > now, if I had b0-b3 and had to compute the output y(t), Matlab's filter > function can solve it easily. > but I don't have a clue how can I estimate b0-b3 from y(t). > > can someone please help? > > Thanks in advance, > Flashman.
I think what I would do is: 1. get the FFT of the output signal (y(t)) This will give you the complex frequency response of the output. 2. use INVFREQZ to obtain the coefficients of the filter that had that response. Maurice Givens
> >help tfestimate >
As I wrote only from OUTPUT data samples (y(t))... so tfestimate can't help because I need the input x(t).
>Maybe I don't understand the question. If it is a moving average filter
with 4
>coefficients, it looks like a[1 1 1 1] where a is some constant factor of
gain.
>If you are asking how to determine what a is by looking only at the
output - I
>don't think you can. > >-jim >
Jim, Oli is right. The parameters don't have to be [1 1 1 1] in this model...
> >I think what I would do is: >1. get the FFT of the output signal (y(t)) >This will give you the complex frequency response of the output. > >2. use INVFREQZ to obtain the coefficients of the filter that had that >response. > >Maurice Givens >
well, it could be helpful (someone told me it could be done by 2 functions so maybe you are right). Two things I don't understand: 1. Where is the estimation for the coefficients? when you use INVFREQZ function? 2. Getting the FFT by: Y=fft(y); and now, how do I use INVFREQZ? Do I need to define w variable for the frequancy? [b,a] = invfreqz(h,w,3,0); and what is h? thanks for all your answers! Flashman.
On 5 Jan., 13:28, "Flashman" <ya...@doar.afeka.ac.il> wrote:
> Hello everyone, > > first, please excuse me for spelling or grammer mistakes. > > I was asked to estimate ,with Matlab, an MA filter's (FIR filter) > coefficients only from 10,000 output data samples (y(t)) which I've been > given on a DAT file. > > The filter is a 3rd order filter, so i need to compute b0, b1, b2, b3 > coefficients. The input signal x(t) is a white gaussian noise: &#4294967295; > x= rand(1,10000) > > now, if I had b0-b3 and had to compute the output y(t), Matlab's filter > function can solve it easily. > but I don't have a clue how can I estimate b0-b3 from y(t). > > can someone please help? > > Thanks in advance, > Flashman.
The problem is not well-posed. You can only estimate the magnitude response of the filter, but not the phase response. In other words, all filters with the same magnitude response are equally likely candidates (however, with 5 coefficients there are only 5 alternative FIR filters with equal magnitude reponse, so not much choice anyway). Without prior knowledge, fixing a linear-phase response is as educated a guess as any other, but makes it possible to use a linear technique to estimate the filter coefficients (FDLS). Regards, Andor
On Mon, 5 Jan 2009 05:44:08 -0800 (PST), Oli Charlesworth
<catch@olifilth.co.uk> wrote:

>On Jan 5, 12:57&#4294967295;pm, jim <".sjedgingN0sp"@m...@mwt.net> wrote: >> Flashman wrote: >> >> > Hello everyone, >> >> > first, please excuse me for spelling or grammer mistakes. >> >> > I was asked to estimate ,with Matlab, an MA filter's (FIR filter) >> > coefficients only from 10,000 output data samples (y(t)) which I've been >> > given on a DAT file. >> >> > The filter is a 3rd order filter, so i need to compute b0, b1, b2, b3 >> > coefficients. The input signal x(t) is a white gaussian noise: >> > x= rand(1,10000) >> >> > now, if I had b0-b3 and had to compute the output y(t), Matlab's filter >> > function can solve it easily. >> > but I don't have a clue how can I estimate b0-b3 from y(t). >> >> Maybe I don't understand the question. If it is a moving average filter with 4 >> coefficients, it looks like a[1 1 1 1] where a is some constant factor of gain. >> If you are asking how to determine what a is by looking only at the output - I >> don't think you can. > >In statistics, the term "moving average" is much more general. See >e.g. http://en.wikipedia.org/wiki/Moving_average_model or >http://en.wikipedia.org/wiki/Autoregressive_moving_average_model.
Hi Oli, Ha ha. Language language language. When I first read the OP's words: "MA filter's" I assumed he meant coefficients all having the same value. Then when he wrote: "b0-b3", I wasn't so sure. I don't consider a convolutional FIR filter having different-valued coefficients as a "moving-average filter", because such filters do not compute moving averages. The OP should have been a little more clear. But no super-big deal, such confusion happens all the time here. See Ya', [-Rick-]