sinc function

조회 수: 3 (최근 30일)
Lily
Lily 2011년 4월 15일
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일
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일
The value is undefined at that location. What are you hoping to have plotted there?

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by