Borrar filtros
Borrar filtros

How to plot a graph that consist all quadrant ?

4 visualizaciones (últimos 30 días)
Odien
Odien el 22 de Ag. de 2015
Comentada: Ashish Kulkarni el 6 de Sept. de 2021
x = -100:10: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 script file, but the matlab only show the 1st and 4th quadrant of the graph!
I need all the quadrant include 2nd and 3rd in order to show the intercept of each graph.

Respuestas (1)

Walter Roberson
Walter Roberson el 22 de Ag. de 2015
That code does show all the quadrants. It shows x from -100 to +100 and y from -2000 to +500. 6 lines are plotted. The yellow (L plot) might be difficult to see against the background, and the q and h plots are nearly on top of each other so it can be difficult to tell the lines apart.
You might want to move the legend to southeast instead of northeast.
  3 comentarios
Ashish Kulkarni
Ashish Kulkarni el 6 de Sept. de 2021
Change your command to
legend('L(X)','g(x)','q(x)','h(x)','L2(x)','f(x)', 'location','southoutside','Orientation','horizontal')
and you'll get the legends horizontally

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by