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),'*');

 採用された回答

Matt Fig
Matt Fig 2011 年 4 月 15 日

2 投票

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 件のコメント

Lily
Lily 2011 年 4 月 15 日
Thank you :)

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 4 月 15 日

0 投票

The value is undefined at that location. What are you hoping to have plotted there?

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

タグ

質問済み:

2011 年 4 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by