sinc function

7 Ansichten (letzte 30 Tage)
Lily
Lily am 15 Apr. 2011
At y=0, the graph is not plotted. How would I plot it, to compare to the sinc(x) function. Thanks in advanced.
x=-20:0.1:20;
y=(sin(pi*x))/(pi*x);
if x=0
.....
end
plot(x,y,);
hold on
plot (x,sinc(x),'*');

Akzeptierte Antwort

Matt Fig
Matt Fig am 15 Apr. 2011
x = -20:0.0001:20;
y = (sin(pi*x))./(pi*x);
y(x==0) = 1;% If you don't get: (Warning: Divide by zero.) you missed 0.
plot(x,y)
  1 Kommentar
Lily
Lily am 15 Apr. 2011
Thank you :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 15 Apr. 2011
The value is undefined at that location. What are you hoping to have plotted there?

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by