Plotting of graph showing increasing & decreasing in the same plot
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Walter Roberson
2017 年 9 月 28 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!