Sine wave plot for different frequency

4 ビュー (過去 30 日間)
Mariya Ferdousi
Mariya Ferdousi 2018 年 7 月 23 日
回答済み: Aquatris 2018 年 7 月 23 日
I am trying to write a code to build a matrix of a sine wave for different frequency. For example
f = 1:20
Fs = 200; % Sampling frequency
t = 0:1/Fs:1; % Time vector of 1 second
amp = 1;
for k = 1:length(f)
x(k) = amp * sin(2*pi*t*f(k));
end
For every frequency(f) I want to calculate the value of x. I want to build a matrix where column indexing the frequency of sine wave and row indexing the value of x.
I have faced difficulties to write this code. Any suggestion from anyone will be greatly appreciated.
Thanks in advance.

採用された回答

Aquatris
Aquatris 2018 年 7 月 23 日
Here is the code;
f = 1:20
Fs = 200; % Sampling frequency
t = 0:1/Fs:1; % Time vector of 1 second
amp = 1;
x = amp * sin(2*pi*t'*f);

その他の回答 (0 件)

カテゴリ

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