Plotting of graph showing increasing & decreasing in the same plot
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
LAWRENCE DUMEBI
el 28 de Sept. de 2017
Respondida: Walter Roberson
el 28 de Sept. de 2017
I want to plot a graph which should display increasing shape, decreasing shape, etc in one graph without any of the curves affecting each other. How do I modify my code to get this result.
Code:
clear all
x = linspace(0,10);
for i1 = 1:3
q = input('input the shape parameter theta q');
b = input('input the scale parameter beta b');
f = zeros(1,3);
for ii = 1:length(x)
f(ii) = b*q^2*(1+b*x(ii))/(1+b+b*q*x(ii));
end
plot(x,f,'linewidth',2)
hold on
end
legend('\theta=0.5,\beta=0.2','\theta=1.0,\beta=0.2','\theta=1.5,\beta=0.2')
hold off
0 comentarios
Respuesta aceptada
Walter Roberson
el 28 de Sept. de 2017
To avoid having any of the plots affect the others, you will need to add a line color specification to the plot() command. With the way you have it now, in all versions from R2014b onwards, the "hold on" would trigger automatic use of the "next" color in the ColorOrder property of the axes, so the fact that you made a plot would affect the color given to another plot, contrary to your instructions.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!