how to generate a sine function of time with 1024 second long ... and generate 8 full cycle over this interval ....

 採用された回答

Image Analyst
Image Analyst 2020 年 9 月 14 日
編集済み: Image Analyst 2020 年 9 月 14 日

0 投票

How many samples do you want over that 1024 seconds? Let's say it's 50,000:
numSamples = 50000;
t = linspace(0, 1024, numSamples);
period = numSamples / 8; % Want 8 full cycles
amplitude = 1; % Whatever.
y = amplitude * sin(2 * pi * t / period);
plot(t, y, 'b-', 'LineWidth', 2);
grid on;
xlabel('t', 'FontSize', 20);
ylabel('y', 'FontSize', 20);

2 件のコメント

aa
aa 2020 年 9 月 14 日
I need 1024 sample only ... I just try to run tghis code but it gives error
Image Analyst
Image Analyst 2020 年 9 月 14 日
numSamples = 1024;
t = linspace(0, 1024, numSamples);
period = numSamples / 8; % Want 8 full cycles
amplitude = 1; % Whatever.
y = amplitude * sin(2 * pi * t / period);
plot(t, y, 'b-', 'LineWidth', 2);
grid on;
xlabel('t', 'FontSize', 20);
ylabel('y', 'FontSize', 20);

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

質問済み:

aa
2020 年 9 月 14 日

コメント済み:

2020 年 9 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by