why my last element in the array isn't being plotted ?
조회 수: 1 (최근 30일)
이전 댓글 표시
i am plotting this arra using stairs function, but when I plot it doesnt plot the last element in the array
x=([0 1 1 0 1])
figure(1)
z=stairs(0:length(x)-1,x)
%plot(x)
ylim([-0.2 1.2]);
댓글 수: 1
dpb
2019년 12월 25일
It does, it's just occluded by the RH axis
xl=xlim; % retrieve x limits
xlim([xl(1) 1.05*xl(2)]) % increase RH a little
Or, you could increase the linewidth property to make the line bold enough to stand out or change colors or ...
답변 (1개)
Image Analyst
2019년 12월 25일
Try this improved code:
yValues = ([0 1 1 0 1])
xValues = 0 : length(yValues) - 1;
z = stairs(xValues, yValues, 'LineWidth', 3)
grid on;
ylim([-0.2 1.2]);
xlim([0, 5]);
xlabel('X', 'FontSize', 15);
ylabel('Z', 'FontSize', 15);
title('Z vs. X', 'FontSize', 15);

댓글 수: 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!