Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
find zero values of sinc

Subject: find zero values of sinc

From: David

Date: 18 Dec, 2008 22:02:02

Message: 1 of 10

hi all:

i want to find the zero values of sinc, where sinc = sin(pi*x)./(pi*x)

x = -5.5:0.1:5.5;
sinc = sin(pi*x)./(pi*x);
plot(x, sinc)


you can clearly see the zero crossings, but find(sinc == 0) is null (i think) because i've discretized a continuous function, and none of the values are exactly zero.

then i tried to convert sinc into a continuous function: mysinc = @(x)sin(pi*x)./(pi*x)
(don't ask me why i didn't type mysinc = 'sin(pi*x)./(pi*x)'; instead, because i learn by example)

this is where i get stuck. matlab seems to have good ways to find the roots of polynomials, but this function is not a polynomial. do i need to convert it into a polynomial form using euler relations or something ?


Thanks!

Subject: find zero values of sinc

From: Adam

Date: 18 Dec, 2008 22:13:03

Message: 2 of 10

"David " <REMOVEdavidg@UPPERCASEphy.LETTERSucsf.edu> wrote in message <gieh8q$1g6$1@fred.mathworks.com>...
> hi all:
>
> i want to find the zero values of sinc, where sinc = sin(pi*x)./(pi*x)
>
> x = -5.5:0.1:5.5;
> sinc = sin(pi*x)./(pi*x);
> plot(x, sinc)
>
>
> you can clearly see the zero crossings, but find(sinc == 0) is null (i think) because i've discretized a continuous function, and none of the values are exactly zero.
>
> then i tried to convert sinc into a continuous function: mysinc = @(x)sin(pi*x)./(pi*x)
> (don't ask me why i didn't type mysinc = 'sin(pi*x)./(pi*x)'; instead, because i learn by example)
>
> this is where i get stuck. matlab seems to have good ways to find the roots of polynomials, but this function is not a polynomial. do i need to convert it into a polynomial form using euler relations or something ?
>
>
> Thanks!
 
You're not likely to ever get exact zeros. They're probably off by a couple eps().

Sinc() is a built-in function. You should probably use a different variable name.

Look for zero crossings?
idx = find(diff(sign(sinc)));
x(ans)

~Adam

Subject: Thanks Re: find zero values of sinc

From: David

Date: 18 Dec, 2008 23:43:03

Message: 3 of 10

ahh smart

thanks!

"Adam" <not.real@email.com> wrote in message <giehtf$ct1$1@fred.mathworks.com>...
> "David " <REMOVEdavidg@UPPERCASEphy.LETTERSucsf.edu> wrote in message <gieh8q$1g6$1@fred.mathworks.com>...
> > hi all:
> >
> > i want to find the zero values of sinc, where sinc = sin(pi*x)./(pi*x)
> >
> > x = -5.5:0.1:5.5;
> > sinc = sin(pi*x)./(pi*x);
> > plot(x, sinc)
> >
> >
> > you can clearly see the zero crossings, but find(sinc == 0) is null (i think) because i've discretized a continuous function, and none of the values are exactly zero.
> >
> > then i tried to convert sinc into a continuous function: mysinc = @(x)sin(pi*x)./(pi*x)
> > (don't ask me why i didn't type mysinc = 'sin(pi*x)./(pi*x)'; instead, because i learn by example)
> >
> > this is where i get stuck. matlab seems to have good ways to find the roots of polynomials, but this function is not a polynomial. do i need to convert it into a polynomial form using euler relations or something ?
> >
> >
> > Thanks!
>
> You're not likely to ever get exact zeros. They're probably off by a couple eps().
>
> Sinc() is a built-in function. You should probably use a different variable name.
>
> Look for zero crossings?
> idx = find(diff(sign(sinc)));
> x(ans)
>
> ~Adam

Subject: find zero values of sinc

From: Roger Stafford

Date: 19 Dec, 2008 00:58:02

Message: 4 of 10

"David " <REMOVEdavidg@UPPERCASEphy.LETTERSucsf.edu> wrote in message <gieh8q$1g6$1@fred.mathworks.com>...
> hi all:
>
> i want to find the zero values of sinc, where sinc = sin(pi*x)./(pi*x)
>
> x = -5.5:0.1:5.5;
> sinc = sin(pi*x)./(pi*x);
> plot(x, sinc)
>
> you can clearly see the zero crossings, but find(sinc == 0) is null (i think) because i've discretized a continuous function, and none of the values are exactly zero.
>
> then i tried to convert sinc into a continuous function: mysinc = @(x)sin(pi*x)./(pi*x)
> (don't ask me why i didn't type mysinc = 'sin(pi*x)./(pi*x)'; instead, because i learn by example)
>
> this is where i get stuck. matlab seems to have good ways to find the roots of polynomials, but this function is not a polynomial. do i need to convert it into a polynomial form using euler relations or something ?
>
> Thanks!

  This is just what matlab's 'fzero' is designed for. The trick in using it is in choosing the appropriate initial estimate, and since sinc has infinitely many zero crossings that is especially important in converging on the one you want.

Roger Stafford

Subject: find zero values of sinc

From: Jonathan

Date: 19 Dec, 2008 18:04:02

Message: 5 of 10

"David " <REMOVEdavidg@UPPERCASEphy.LETTERSucsf.edu> wrote in message <gieh8q$1g6$1@fred.mathworks.com>...
> hi all:
>
> i want to find the zero values of sinc, where sinc = sin(pi*x)./(pi*x)
>
> x = -5.5:0.1:5.5;
> sinc = sin(pi*x)./(pi*x);
> plot(x, sinc)
>
>
> you can clearly see the zero crossings, but find(sinc == 0) is null (i think) because i've discretized a continuous function, and none of the values are exactly zero.
>
> then i tried to convert sinc into a continuous function: mysinc = @(x)sin(pi*x)./(pi*x)
> (don't ask me why i didn't type mysinc = 'sin(pi*x)./(pi*x)'; instead, because i learn by example)
>
> this is where i get stuck. matlab seems to have good ways to find the roots of polynomials, but this function is not a polynomial. do i need to convert it into a polynomial form using euler relations or something ?
>

The zeroes are just all integers except for 0.

Subject: find zero values of sinc

From: David

Date: 19 Dec, 2008 19:25:03

Message: 6 of 10

"Jonathan " <sievers.notreally.@cita.utoronto.ca> wrote in message <gignmi$87u$1@fred.mathworks.com>...
> "David " <REMOVEdavidg@UPPERCASEphy.LETTERSucsf.edu> wrote in message <gieh8q$1g6$1@fred.mathworks.com>...
> > hi all:
> >
> > i want to find the zero values of sinc, where sinc = sin(pi*x)./(pi*x)
> >
> > x = -5.5:0.1:5.5;
> > sinc = sin(pi*x)./(pi*x);
> > plot(x, sinc)
> >
> >
> > you can clearly see the zero crossings, but find(sinc == 0) is null (i think) because i've discretized a continuous function, and none of the values are exactly zero.
> >
> > then i tried to convert sinc into a continuous function: mysinc = @(x)sin(pi*x)./(pi*x)
> > (don't ask me why i didn't type mysinc = 'sin(pi*x)./(pi*x)'; instead, because i learn by example)
> >
> > this is where i get stuck. matlab seems to have good ways to find the roots of polynomials, but this function is not a polynomial. do i need to convert it into a polynomial form using euler relations or something ?
> >
>
> The zeroes are just all integers except for 0.

yes! i noticed that, i'm still muddling over that result. i wasn't sure if i should act spooked, or like a dully unimpressed high-school geometry student. the ratio of two irrational numbers giving me the sequence of integers like that. was going to ask about it on mathnerds

Subject: find zero values of sinc

From: Walter Roberson

Date: 19 Dec, 2008 20:41:48

Message: 7 of 10

David wrote:
> "Jonathan " <sievers.notreally.@cita.utoronto.ca> wrote in message <gignmi$87u$1@fred.mathworks.com>...
>> "David " <REMOVEdavidg@UPPERCASEphy.LETTERSucsf.edu> wrote in message <gieh8q$1g6$1@fred.mathworks.com>...

>>> i want to find the zero values of sinc, where sinc = sin(pi*x)./(pi*x)

>> The zeroes are just all integers except for 0.
 
> yes! i noticed that, i'm still muddling over that result. i wasn't sure if i should act
> spooked, or like a dully unimpressed high-school geometry student.

The result should not surprise you at all. pi*x is a non-zero constant except when x is 0,
and if x is 0 then sin(pi*0) is sin(0) so you have 0/0 which is not defined, so you
need to exclude 0 from the solutions. But for non-zero x, pi*x will never be 0, so
if you are looking for a zero of sin(pi*x) ./ (pi*x) then clearly the other zeros
will depend only on the numerator, sin(pi*x). And anyone who has done enough math
to have learned about sine knows that when you are working with radians, the zeros
of sine occur every pi radians regular as clock-work.

--
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Subject: (.)dot sign in sinc plot

From: saher

Date: 29 Nov, 2013 14:25:13

Message: 8 of 10

Hello,
x = -10:0.01:10;
y = (sin(pi*x)) ./ (pi*x);
plot(x,y),grid

Can anyone explain me why i need to put a (.)dot sign with the division sign for the above code. The code doesn't works with out it.
Thanks



Walter Roberson <roberson@hushmail.com> wrote in message <6GT2l.73125$zQ3.49044@newsfe12.iad>...
> David wrote:
> > "Jonathan " <sievers.notreally.@cita.utoronto.ca> wrote in message <gignmi$87u$1@fred.mathworks.com>...
> >> "David " <REMOVEdavidg@UPPERCASEphy.LETTERSucsf.edu> wrote in message <gieh8q$1g6$1@fred.mathworks.com>...
>
> >>> i want to find the zero values of sinc, where sinc = sin(pi*x)./(pi*x)
>
> >> The zeroes are just all integers except for 0.
>
> > yes! i noticed that, i'm still muddling over that result. i wasn't sure if i should act
> > spooked, or like a dully unimpressed high-school geometry student.
>
> The result should not surprise you at all. pi*x is a non-zero constant except when x is 0,
> and if x is 0 then sin(pi*0) is sin(0) so you have 0/0 which is not defined, so you
> need to exclude 0 from the solutions. But for non-zero x, pi*x will never be 0, so
> if you are looking for a zero of sin(pi*x) ./ (pi*x) then clearly the other zeros
> will depend only on the numerator, sin(pi*x). And anyone who has done enough math
> to have learned about sine knows that when you are working with radians, the zeros
> of sine occur every pi radians regular as clock-work.
>
> --
> .signature note: I am now avoiding replying to unclear or ambiguous postings.
> Please review questions before posting them. Be specific. Use examples of what you mean,
> of what you don't mean. Specify boundary conditions, and data classes and value
> relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Subject: (.)dot sign in sinc plot

From: dpb

Date: 29 Nov, 2013 15:14:28

Message: 9 of 10

On 11/29/2013 8:25 AM, saher wrote:
> Hello,
> x = -10:0.01:10;
> y = (sin(pi*x)) ./ (pi*x);
> plot(x,y),grid
>
> Can anyone explain me why i need to put a (.)dot sign with the division
> sign for the above code. The code doesn't works with out it.
...


doc times

--

Subject: (.)dot sign in sinc plot

From: Nasser M. Abbasi

Date: 30 Nov, 2013 00:36:02

Message: 10 of 10

On 11/29/2013 8:25 AM, saher wrote:
> Hello,
> x = -10:0.01:10;
> y = (sin(pi*x)) ./ (pi*x);
> plot(x,y),grid
>
> Can anyone explain me why i need to put a (.)dot sign with the
/division sign for the above code. The code doesn't works with out it.
> Thanks
>

Becuase there is no division operation defined for vectors.

What is [1 2 3]/[4 5 6] ?

So a dot tells Matlab to do thing element by element.

see help on many places on this

http://www.mathworks.com/help/matlab/ref/power.html
etc..

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us