Plot only for positive y
55 次查看(过去 30 天)
显示 更早的评论
I have
plot(x,y)
hold on
plot(x,z)
hold on
plot(x,w)
I need to have a plot for only positive y and z. I try to write
ylim([0,yMax])
But I do not know how to set for yMax. Please advise.
2 个评论
采纳的回答
OCDER
2018-6-12
编辑:OCDER
2018-6-13
NEW ANSWER
ylim([0 inf]) %Will automatically compute the limit where "inf" is used
OLD ANSWER
ylim([0, max([y(:); z(:); w(:)]))
%will plot positive values of y axis from 0 to the maximum of either your y or z or w values.
3 个评论
OCDER
2018-6-13
Actually, there was an easier solution. I'll update the answer:
ylim([0 inf]) %will automatically compute the limit where "inf" is used
Jack
2023-5-14
this doesnt seem to work on my graph bit confused any ideas how I could be messing it up? im putting it after the plot(x,y) and have tried after title labels and after hold on so bit confused.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!