Scale on x-axis
20 ビュー (過去 30 日間)
古いコメントを表示
I have a vector of 256 data points which is equal to 0.8 ms in total. How do I set the scale from 0 to 0.8, with steps for example of 0.2?
0 件のコメント
回答 (2 件)
HWIK
2022 年 1 月 15 日
Try this:
set(gca, 'XTick', 0:0.2:0.8)
6 件のコメント
Star Strider
2022 年 1 月 15 日
I completely failed Mind Reading 101 as an undergraduate, and as the result decided to major in Chemistry instead. It was easier.
Image Analyst
2022 年 1 月 16 日
Use the xticks(0:0.2:0.8) function:
Full demo:
% Create sample data.
x = linspace(0, 0.8, 256);
period = 0.2;
y = sin(2 * pi * x / period);
plot(x, y, 'b-', 'LineWidth', 3)
grid on
% Current tick marks are 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8.
% Make them 0, 0.2, 0.4, 0.6, 0.8 using the xticks() function:
xticks(0 : 0.2: 0.8)
It replaces the old set(gca, 'XTick', 0:0.2:0.8) way of doing it (since r2016b).
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Lighting, Transparency, and Shading についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!