help-octave
[Top][All Lists]

## fir1 function and max value of the sinc signal

 From: alfredd Subject: fir1 function and max value of the sinc signal Date: Sat, 9 Nov 2013 01:52:59 -0800 (PST)

```hello.

im doing a little research on the sinc wave to implemelt lowpass fir
filtering.

here is how i get it:
theoretically, the sinc is expressed by h(n)=sin(w_c*n)/pi*n
claculating this for M+1 points i get the coeffs (this equals using
rectangular window).
in case n=0 and M is an even number, the value of the sinc function at h(0)
should be w_c/pi().Next,
for causality issues, i then shift the calculated sinc M/2 points. So, what
was previously h(0) is now shifted to h((M/2)+1)

for example, if i want the cutoff to be at 2kHz @ sampling frequency 48kHz,
then i set w_c=1/12*pi().
Also, lets set M=100

In this example, h(51) should be w_c/pi=1/12=0.083333(3)

when i try to generate the same sinc with octave fir1 function, i issue the
command
b=fir1(100, 1/12, 'low', rectwin(101), 'noscale')

Suprisingly, i get h(51)=0.086134413176329...
but i expexted h(51)=0.0833333333333...

The fir1 in matlab outputs the same value as octave. this means that there
is no bug, but instead my understanding of the theory is a bit crooked.

h(51)=0.0833333333333...
is it related to the round off error of the floating point value? if this is
the case, how can i get more precision out of the function?

Alfred Liin

--
View this message in context:
http://octave.1599824.n4.nabble.com/fir1-function-and-max-value-of-the-sinc-signal-tp4658968.html
Sent from the Octave - General mailing list archive at Nabble.com.

```