how to have a variable axis in matlab
이전 댓글 표시
I have measurements every 0.1 metres for points 1-470, then measurements every 0.05 metres for points 470-530. How can I change these to reflect their values in space? (the first 470 points measure from a distance of 0 to 47 metres, whereas the last 60 points measure a distance of 47 to 50 metres). I would like for the scale to be uniform from 0-50 metres, even though for the last 3 metres the points are more frequent than in the first 47 metres.
I have tried using x-ticks, but this does not reflect that the final 60 points are in a more condensed space than the first 470.
Thank you
댓글 수: 2
Jan
2019년 4월 1일
Please post which code you have tried and explain, what you want to achieve. What does "change these to reflect their values in space" mean? How should what be reflected?
Annabel Murley
2019년 4월 1일
답변 (1개)
Do not change only the XTicks, but adjust the X-values also:
x = [1, 2, 3, 4, 5, 5.1, 5.2, 5.3, 5.4, 5.5]
y = rand(size(x));
subplot(1,2,1)
plot(y)
subplot(1,2,2)
plot(x, y) % <== Use 2 inputs to define the x-values also
Without specifying the X-values, Matlab assumes, that they are 1:numel(y).
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
