sinc + cos function plot

4 views (last 30 days)
민건 김
민건 김 on 13 May 2023
Edited: Stephen23 on 13 May 2023
Respectively, codes, matlab plot, and graphing site plot.
Even though I made same argument, matlab plot gives wrong plot. What's wrong? I need your help.
  3 Comments
James Tursa
James Tursa on 13 May 2023
Please post code as regular text highlighed by the CODE button. We can't run images.
민건 김
민건 김 on 13 May 2023
I figured out what's wrong. I thought sinc at matlab gives sin(x)/x but basically it gives sin(pi x)/pi x. Here, I wanna plot former one, which is unnormalized one, but I don't know how to, either.... Haha

Sign in to comment.

Accepted Answer

VBBV
VBBV on 13 May 2023
Delete pi from below line
% delete pi from the below line
a = (-4:0.001:4);
p = 10;
f = p*sinc(a) + cos(a)
f = 1×8001
-0.6536 -0.6569 -0.6602 -0.6634 -0.6667 -0.6699 -0.6732 -0.6765 -0.6797 -0.6830 -0.6862 -0.6895 -0.6928 -0.6960 -0.6993 -0.7025 -0.7058 -0.7091 -0.7123 -0.7156 -0.7189 -0.7221 -0.7254 -0.7287 -0.7319 -0.7352 -0.7384 -0.7417 -0.7450 -0.7482
plot(a,f)
  5 Comments
Walter Roberson
Walter Roberson on 13 May 2023
Note however
x = 0
x = 0
sinc(x)
ans = 1
sin(x)./x
ans = NaN
Stephen23
Stephen23 on 13 May 2023
Edited: Stephen23 on 13 May 2023
"By definition sinc can be written as (sinx / x) "
Except in the field of digital signal processing where it is commonly defined as
sin(pi*x) / (pi*x)
which is the definition that SINC uses, SINC being part of the Signal Processing toolbox:
"In the context of digital signal processing, we often use an alternative form in which the independent variable is multiplied by π":
" The sinc function is defined as: sinc(a) = sin(πa)/(πa)":

Sign in to comment.

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!