Set y axis limits matlab plot

可紊 提交于 2019-12-19 11:39:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!