how can i plot a sine wave with different peak amplitudes

回答 (2 件)

Joseph Cheng
Joseph Cheng 2016 年 2 月 4 日

0 投票

you can add different sine waves together that have different amplitudes and periods. ex:
t = 0:.1:100;
amp = zeros(size(t));
for ind = 1:5
amp = rand(1)*sin(2*pi*t/randi(20,1,1)+20*randi(5))+amp;
end
figure,plot(t,amp)
just a flavor since i don't know exactly what constrains you have on the sine wave.
BIBIN SOORAJ R
BIBIN SOORAJ R 2021 年 4 月 3 日

0 投票

t = 0:.1:100;
amp = zeros(size(t));
for ind = 1:5
amp = rand(1)*sin(2*pi*t/randi(20,1,1)+20*randi(5))+amp;
end
figure,plot
(t,amp)

1 件のコメント

Image Analyst
Image Analyst 2021 年 4 月 3 日
@BIBIN SOORAJ R, your answer looks like you just copied it from @Joseph Cheng's answer. Is anything different (other than you introducing the error of splitting the last line into two)?

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

質問済み:

2016 年 2 月 4 日

コメント済み:

2021 年 4 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by