フィルターのクリア

Discrete sine wave - incorrect sine wave

12 ビュー (過去 30 日間)
James
James 2015 年 5 月 21 日
回答済み: Walter Roberson 2015 年 5 月 21 日
Hi guys.. I am getting very confused on some basic things which irretates me alot. I am trying make a dataset contanning a sine wave, the problem is though i cannot make it seem correct.
Here is my code:
fs = 100; %amount of samples pr. sec
Ts = 1/fs; %sample rate
n = 0:6; % time interval
f = 1/5; % frequency
y = chop(0.799760*sin(2*pi*f*(n*Ts)),5); % vector with discretized sinewave with given f as freq, and ts sample rate.
plot(n,y); % plot it.
When i plot it doesn't look like a correct sine wave, ie. this example doesn't have period of 5 sec, but a lot more.. what am doing wrong.

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 5 月 21 日
Replace your
n = 0:6;
with
n = linspace(0,6,100);

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by