# Thread: equations to matlab function

1. ## 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?

2. 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

3. "x: y[n] = <x[n:n-N+1],h[1:N]>"

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

4. 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