I want to have specific values on y-axis of the plot.
45 次查看(过去 30 天)
显示 更早的评论
clc, clear, close all
u = 0.2;
for n = 1:40
v(n) = (41/81)*u + 20/81;
u = v(n);
end
plot(1:40,v,'.-','LineWidth',1,'color','b')
hold on
0 个评论
回答(1 个)
Dave B
2022-4-7
编辑:Dave B
2022-4-7
To set the y tick values, you can use the YTick property on the Axes. You can use gca and set to apply these to the current axes:
u = 0.2;
for n = 1:40
v(n) = (41/81)*u + 20/81;
u = v(n);
end
plot(1:40,v,'.-','LineWidth',1,'color','b')
set(gca,'YTick',[.35 .4 .42 .44 .46 .5])
figure
plot(1:40,v,'.-','LineWidth',1,'color','b')
yticks([.35 .36 .4 .42 .43 .45])
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Properties 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!