DSPRelated.com
Forums

error "divide by zero" in "design of linear phase FIR filters using windows" plz help!!!!

Started by Unknown July 25, 2005
I am doing homework on "design of linear phase FIR filters using
windows"

The unit sample response of the FIR filter is

h(n)=sin((pi./6).*(n-12))./(pi.*(n-12));

The filter has 25 taps.

I need to plot |H(omega)| in MATLAB
where H is the Fourier Transform of h(n)=SUM(0->24)of
(h(n)*exp(-j*omega*n))

but I got stuck here since at n=12, the h(n) is 0/0 and MATLAB gives an
error: "Divide by zero".

How to solve the problem out?

thank you very much.

Sincerely yours.

sin(0)/0 is supposed to be 1.  If you use Matlab's Signal Processing Toolbox 
sinc function rather than explicitly using sin(x)/x, it will work properly.  See 
http://www-ccs.ucsd.edu/matlab/toolbox/signal/sinc.html or type help sinc.

-- 
Jon Harris
SPAM blocker in place:
Remove 99 (but leave 7) to reply
<VijaKhara@gmail.com> wrote in message 
news:1122340076.575924.106830@g43g2000cwa.googlegroups.com...
>I am doing homework on "design of linear phase FIR filters using > windows" > > The unit sample response of the FIR filter is > > h(n)=sin((pi./6).*(n-12))./(pi.*(n-12)); > > The filter has 25 taps. > > I need to plot |H(omega)| in MATLAB > where H is the Fourier Transform of h(n)=SUM(0->24)of > (h(n)*exp(-j*omega*n)) > > but I got stuck here since at n=12, the h(n) is 0/0 and MATLAB gives an > error: "Divide by zero". > > How to solve the problem out? > > thank you very much. > > Sincerely yours. >
thank you very much. :)

Keep in mind that you have sin(x/6)/x, not sin(x)/x

lim(x->0) of sin(x/6)/x is not 1.

Dirk

Hello,
To understand how to handle the 0/0 thing, look up L'Hospital's rule.We
don't mind helping with workwork as long as the student:

1) Informs us this is homework

2) Really tries to do the problem

Then we can give hints and pointers. Because the point in doing
homework is to force you to deal with real problems.

Clay

Clay wrote:


> To understand how to handle the 0/0 thing, look up L'Hospital's rule.We > don't mind helping with workwork as long as the student:
Did you know that L'Hopital didn't invent the rule, but took credit for someone else's rule? I don't remember anymore who, but it is in the book "Zero: the biography of a dangerous idea." -- glen
"glen herrmannsfeldt" <gah@ugcs.caltech.edu> wrote in message 
news:rc6dneMilb_oqXrfRVn-vA@comcast.com...
> Clay wrote: > > >> To understand how to handle the 0/0 thing, look up L'Hospital's rule.We >> don't mind helping with workwork as long as the student: > > Did you know that L'Hopital didn't invent the rule, but took > credit for someone else's rule? I don't remember anymore who, but > it is in the book "Zero: the biography of a dangerous idea." > > -- glen >
Interesting! I'll have to look in to it. I recall a discussion with a friend ( a gun historian) recently where he was telling me the history behind the Thompson machine gun. And of course General Thompson didn't invent it, but the inventors wanted to put Thompson's name on it and he finally reluctantly agreed, and that is the name we now know. One has to go to the actual patent to find the inventors. So I wonder how L'Hospital's name came to be placed on the "rule"? Clay
Clay S. Turner wrote:

> "glen herrmannsfeldt" wrote
(snip)
>>Did you know that L'Hopital didn't invent the rule, but took >>credit for someone else's rule? I don't remember anymore who, but >>it is in the book "Zero: the biography of a dangerous idea."
(snip)
> So I wonder how L'Hospital's name came to be placed on the "rule"?
http://www.lhup.edu/~dsimanek/scihist.htm is the first I find from Google. It seems that it was given to him by Bernouli. L'Hospital paid him as a tutor, and the rights to what he learned. There are some good Bernouli stories in "Five Equations that changed the world." -- glen