问题
I have the following normal distribution and i need to set the graph plot to 1.5 on y axis.
x = -.5:0.0001:3.5;
m1 = 1;
s1 = 0.5;
pdfNormal_1 = normpdf(x, m1, s1);
ylim([0 1.5])
set(gcf,'color','w');
plot(x, pdfNormal_1)%, x, pdfNormal_2);
Could someone tell me how to? Regards
回答1:
The axis function is the one you need.
you can set the axis to the values you want using
axis([xmin xmax ymin ymax])
or you can play with it doing things like:
axis equal
axis tight
axis off
etc
Go to the documentation for more info:
http://www.mathworks.co.uk/help/matlab/ref/axis.html?refresh=true
回答2:
Try this,
x = -.5:0.0001:3.5;
m1 = 1;
s1 = 0.5;
pdfNormal_1 = normpdf(x, m1, s1);
set(gcf,'color','w');
plot(x, pdfNormal_1)%, x, pdfNormal_2);
ylim([0 1.5])
来源:https://stackoverflow.com/questions/26462154/set-y-axis-limits-matlab-plot