i want more numbers details on y axis

조회 수: 98 (최근 30일)
firrou bouteflika
firrou bouteflika 2021년 6월 22일
답변: Steven Lord 2021년 7월 19일
t = [2993;3975.9;5063;6150;6919;8192.7;8862;10240.9;11488;12409.63;13545]
f = @(t) (2.2/9500).*((t/9500).^1.2).*exp(-((t/9500).^2.2))
g = @(t) (2.2/9500).*((t/9500).^1.2)
plot(t,f(t),'co-','linewidth',2,'markeredgecolor','c','markerfacecolor','c')
hold on
plot(t,g(t),'mo-','linewidth',2,'markeredgecolor','m','markerfacecolor','m')
grid on
legend('f(t)','{\lambda}(t)')
xlabel('Temps(h)','fontsize',13)
title('La densité de défaillance et le taux défaillance instantané','fontsize',15)
set(gca,'linewidth',1.5)
  댓글 수: 3
firrou bouteflika
firrou bouteflika 2021년 6월 22일
i already saw it but it didn't help me
Samuel Katongole
Samuel Katongole 2021년 6월 22일
Please try changing the values on the y-axis: add this code to your code
%get insight on the maximum and minimum values of your two functions
g_val=g(t);
f_val=f(t);
ax=axis; % show axis range for your first plot
%let the y-axis values be from the min to the max of your functions above
axis([ax(1:2) min(f_val) max(g_val)])

댓글을 달려면 로그인하십시오.

답변 (3개)

Samuel Katongole
Samuel Katongole 2021년 6월 22일
Please try changing the values on the y-axis: add this code to your code
%get insight on the maximum and minimum values of your two functions
g_val=g(t);
f_val=f(t);
ax=axis; % show axis range for your first plot
% let the y-axis values be from the min to the max of your functions above
axis([ax(1:2) min(f_val) max(g_val)])
  댓글 수: 1
firrou bouteflika
firrou bouteflika 2021년 6월 22일
thank you for your answer but this is not exactly what i wanted but actually i need it and i will use it on another plot on x axis.
now this image will explain what i want, acctually i want less than that like [0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 .....4] and it doesn't have to be 0.00002 just 0.2

댓글을 달려면 로그인하십시오.


Samuel Katongole
Samuel Katongole 2021년 7월 19일
I suppose the follwoing should help. However, it does not display upto 4; but shows what you want
set(gca,'yticklabel',[0:0.2:4]);
  댓글 수: 1
Samuel Katongole
Samuel Katongole 2021년 7월 19일
You should keep in mind that it's only the labeling that has changed; but the axis limits remain the same as for the data. View this with the following:
ax=axis;

댓글을 달려면 로그인하십시오.


Steven Lord
Steven Lord 2021년 7월 19일
x = 1:7;
y = x./7;
plot(x, y, 'o-');
yticks(y)
title('Formatted using the default format')
You can use the TickLabelFormat property of the axis ruler object stored in the YAxis property of the axes.
figure
h = plot(x, y, 'o-');
ax = ancestor(h, 'axes'); % Get the handle of the axes in which the line was plotted
yticks(y)
ax.YAxis.TickLabelFormat = '%0.8f'; % Change the format of the tick labels on the y axis
title('Formatted using format %0.8f')

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

제품


릴리스

R2012a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by