How do I plot this?

2 ビュー (過去 30 日間)
Ladeanne Graycochea
Ladeanne Graycochea 2018 年 2 月 21 日
コメント済み: James Tursa 2018 年 2 月 23 日
y=2*sin(x),if x<20
y=cos(3x),if 20x<40
y=sin(0.3x),if 40x<60
y=8*sin(x),if 60x
y=6,if 6<y
Requirements: (1) The plot should have x label, y label, and title. All of these should be Times New Roman, 12 pt. (2) x range from 1 to 100 with 0.1 increment. Plot x-y.
  2 件のコメント
Star Strider
Star Strider 2018 年 2 月 21 日
This doesn’t make sense:
y=6,if 6<y
Ladeanne Graycochea
Ladeanne Graycochea 2018 年 2 月 22 日
We could ignore that last part.

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

回答 (1 件)

Roger Stafford
Roger Stafford 2018 年 2 月 23 日
I assume you had in mind that x is given in degrees. You will get some discontinuities with these:
x1 = 1:.1:20; y1 = 2*sind(x1);
x2 = 20:.1:40; y2 = cosd(3*x2);
x3 = 40:.1:60; y3 = sind(.3*x3);
x4 = 60:.1:100; y4 = min(8*sind(x4),6);
plot([x1,x2,x3,x4],[y1,y2,y3,y4],'y-')
I will let you work out the label and title details.
  1 件のコメント
James Tursa
James Tursa 2018 年 2 月 23 日
Roger, this is tagged as homework!

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

カテゴリ

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