Plot 2D graph

5 ビュー (過去 30 日間)
Joe anson
Joe anson 2018 年 10 月 2 日
コメント済み: Walter Roberson 2024 年 10 月 16 日
Plot 2D graphs for each of the following functions on an interval [−2π, 2π]. Then plot all the graphs in the same chart and add a title to the graph. sin(x); 2sin(x);3sin(x); 5sin(x); sin(2x); sin(3x); sin(5x)

採用された回答

Jim Riggs
Jim Riggs 2018 年 10 月 2 日
編集済み: Jim Riggs 2018 年 10 月 3 日
Put all the graphs on a single figure:
x=-2*pi:0.04:2*pi;
figure;
plot(x,sin(x),'r');
hold on;
plot(x,2*sin(x),'b');
plot(x,3*sin(x),'g');
plot(x,5*sin(x),'c');
plot(x,sin(2*x),'y');
plot(x,sin(3*x),'m');
plot(x,sin(5*x),'k');
grid on;
title('Figure title');
To make individual graphs:
figure:
plot(x,sin(x),'r');
grid on;
title('Sin(x)');
Next figure:
figure;
plot(x,2*sin(x),'b')
grid on;
title('2*Sin(x)');
etc.

その他の回答 (1 件)

Jagar
Jagar 2024 年 10 月 16 日
編集済み: Walter Roberson 2024 年 10 月 16 日
x=-2*pi:0.04:2*pi;
figure;
plot(x,sin(x),'r');
hold on;
plot(x,2*sin(x),'b');
plot(x,3*sin(x),'g');
plot(x,5*sin(x),'c');
plot(x,sin(2*x),'y');
plot(x,sin(3*x),'m');
plot(x,sin(5*x),'k');
grid on;
title('Figure title');
  1 件のコメント
Walter Roberson
Walter Roberson 2024 年 10 月 16 日
This answer is the same as what @Jim Riggs posted.

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

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by