[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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)


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

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

Can you please explain, why i get h(51)=0.086134413176329... instead of
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?

Thanks in advance,
Alfred Liin

View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]