Multiple Graph plotting manipulation in matlab

7 ビュー (過去 30 日間)
Odien
Odien 2015 年 8 月 23 日
コメント済み: Odien 2015 年 8 月 23 日
x = -100:1:100;
y1 = 0.8*x; %L(x)
y2 = (-27/97750)*x.^3+(4/5)*x; %g(x)
y3 = (-81/9775)*x + (1726/1955)*x -(108/391); %q(x)
y4 = (27/97750)*x.^3 + (-162/1955)*x.^2 +6.6864*x -116.2103; %h(x)
y5 = -1.6*x + 120; %L2(x)
y6 = -0.012*x.^2 + 0.8*x; %f(x)
hold on;
plot(x,y1,'-r')
plot(x,y2,'-g')
plot(x,y3,'-b')
plot(x,y4,'-m')
plot(x,y5,'-y')
plot(x,y6,'-k')
legend('L(X)','g(x)','q(x)','h(x)','L2(x)','f(x)','location','northeast')
xlabel('x-axis')
ylabel('y-axis')
This is my code.
this is the output. Instead of this, i need it to show like this.
any idea how?

回答 (2 件)

the cyclist
the cyclist 2015 年 8 月 23 日
There are many differences between those figures. The most significant one seems to be the differences in range of the y-axis. You can fix that with
ylim([-100 50])
Is that enough? If not, can you please edit your question to itemize the differences you are hoping to rectify?
  1 件のコメント
Odien
Odien 2015 年 8 月 23 日
to make it simple to understand i wan to plot axis at origin..

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


Star Strider
Star Strider 2015 年 8 月 23 日
See Matt Fig’s axescenter function to put the axes in the centre of the plot.
NOTE: It was written in R2007a, so it may not be compatible with R2014b and later. (I haven’t used it recently.)

カテゴリ

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