# equations to matlab function

• Jan 24th 2010, 02:59 PM
amcneilly
equations to matlab function
" Formulate the filter as a sequence of vetcor dot
product between the reference signal h and the
data x: y[n] = <x[n:n-N+1],h[1:N]>. This is esentially
what a FIR filter already does. "

Can anyone help me convert this to a matlab function?
• Jan 28th 2010, 03:09 AM
CaptainBlack
Quote:

Originally Posted by amcneilly
" Formulate the filter as a sequence of vetcor dot
product between the reference signal h and the
data x: y[n] = <x[n:n-N+1],h[1:N]>. This is esentially
what a FIR filter already does. "

Can anyone help me convert this to a matlab function?

y(n)=sum(x(n:n-length(h)+1).*h);

CB
• Jan 29th 2010, 02:17 AM
amcneilly
"x: y[n] = <x[n:n-N+1],h[1:N]>"

Is there an error in the equation? n-N+1 ?
• Jan 29th 2010, 04:32 AM
CaptainBlack
Quote:

Originally Posted by amcneilly
"x: y[n] = <x[n:n-N+1],h[1:N]>"

Is there an error in the equation? n-N+1 ?

Probably depending on how you have defined the FIR and the weights. There should be N consecutive x's in the sum which you do have but the summation may not be in the order that you want.

CB