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!
