How to fill a 1024 point array with two cycles of a cosine wave?

1 回表示 (過去 30 日間)
Kennard Ng
Kennard Ng 2019 年 2 月 11 日
コメント済み: Kennard Ng 2019 年 2 月 11 日
How to fill a 1024 point array with two cycles of a cosine wave?

採用された回答

Luna
Luna 2019 年 2 月 11 日
You can use linspace.
Example:
xData = linspace(0,4*pi,1024);
yData = cos(xData);
figure;
plot(xData,yData);

その他の回答 (1 件)

Guillaume
Guillaume 2019 年 2 月 11 日
Knowing that the cycle length of a cosine wave is , what is the length of two cycles?
Once you know that, use linspace to generate a vector of 1024 points between 0 and that length. Pass that vector to cos and you're done.

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by