필터 지우기
필터 지우기

Scale on x-axis

조회 수: 14 (최근 30일)
Sebastian Daneli
Sebastian Daneli 2022년 1월 15일
답변: Image Analyst 2022년 1월 16일
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?

답변 (2개)

HWIK
HWIK 2022년 1월 15일
Try this:
set(gca, 'XTick', 0:0.2:0.8)
  댓글 수: 6
Star Strider
Star Strider 2022년 1월 15일
@Sebastian Daneli — Please define what ‘does not work’ means in your previous Comment.
I completely failed Mind Reading 101 as an undergraduate, and as the result decided to major in Chemistry instead. It was easier.
John D'Errico
John D'Errico 2022년 1월 15일
Yes, but mind reading is soooo much more fun!

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


Image Analyst
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).

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by