sinc + cos function plot

10 visualizzazioni (ultimi 30 giorni)
민건 김
민건 김 il 13 Mag 2023
Modificato: Stephen23 il 13 Mag 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 Commenti
James Tursa
James Tursa il 13 Mag 2023
Please post code as regular text highlighed by the CODE button. We can't run images.
민건 김
민건 김 il 13 Mag 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

Accedi per commentare.

Risposta accettata

VBBV
VBBV il 13 Mag 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 Commenti
Walter Roberson
Walter Roberson il 13 Mag 2023
Note however
x = 0
x = 0
sinc(x)
ans = 1
sin(x)./x
ans = NaN
Stephen23
Stephen23 il 13 Mag 2023
Modificato: Stephen23 il 13 Mag 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)":

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by