How to plot sin knowing amplitude

5 ビュー (過去 30 日間)
Utrud
Utrud 2017 年 9 月 13 日
回答済み: Rik 2017 年 9 月 13 日
Greetings, I'm still new to Matlab. I have a questiond and i hope you'll be able to help me. Is there a way to plot a sinusoidal wave by knowing the upper and lower limit of the wave? So i have for example 0.3 and 1.4 and i want to plot a sinusoidal wave between those two limits.
Thank you

回答 (1 件)

Rik
Rik 2017 年 9 月 13 日
Try a tutorial on Matlab. This question is probably covered on most tutorials.
upper_limit=1.4;
lower_limit=0.3;
amp=(upper_limit-lower_limit)/2;
avg=(upper_limit+lower_limit)/2;
t=linspace(0,2*pi,20);
y=amp*sin(t)+avg;
figure(1),clf(1)%optional line
plot(t,y)
xlabel('angle'),ylabel('y')%optional line
legend(sprintf('Sine wave with amplitude %.2f and mean of %.2f',amp,avg))%optional line

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by