why my last element in the array isn't being plotted ?
9 ビュー (過去 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!