Why with even numbers the sin looks completly different that with odd number

1 回表示 (過去 30 日間)
Nicolas
Nicolas 2012 年 3 月 15 日
Hello!! I am plotting an easy sin function but I dont understand why when the variable delta is 0.2 0.4 0.6 and so on I get a perfect sin, but on the other hand when I plot it with delta 0.1 0.3 0.5 I get a diffrent plot. I think has to be something with the modulation. Here is goes the code
f=linspace(0.1,10e6);
delta=0.2;
y=sin(pi*f.*delta);
plot(f,y)
Thanks a lot Nicolas

採用された回答

Wayne King
Wayne King 2012 年 3 月 15 日
Nicolas, the problem is with your use of linspace(). The way you are using it you are generating a vector with 100 points equally spaced between 0.1 and 10 million, so the spacing between each of your time points is on the order of 100,000!
t = linspace(0,40,4000);
delta1 = 0.1;
delta2 = 0.2;
y1 = sin(pi*delta1*t);
y2 = sin(pi*delta2*t);
plot(t,y1,'r');
hold on;
plot(t,y2,'b');
  1 件のコメント
Nicolas
Nicolas 2012 年 3 月 15 日
Thank you!I realize where was my mistake, but anyway and knowing that is wrong I dont know why it changes so much, and why always coincide when are odd or even number

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2012 年 3 月 15 日
Welcome to the realities of subsampling and aliasing:

カテゴリ

Help Center および File ExchangeExpansion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by