Scale axes of plot to orders of magnitude

14 views (last 30 days)
Matt Edwards
Matt Edwards on 8 Dec 2016
Edited: Jan on 8 Dec 2016
Hi,
Just started to use Matlab in my engineering course. I've created a plot of data from a Tensile Strength test, this needs to be analysed to find certain properties of the material tested.
The plot has Stress on the y-axis. At the moment it shows 0 - 6 with x10^7 at the top. What I'd like to do is modify it so that the axis shows 0 - 60 and I can write MPa as the units then hide the label at the top. So the axis would show standard orders of magnitude x10^3 would be k (kilo) and x10^9 would be G (Giga).
Ie. Changing what would read as 5.23x10^7, to 52.3 (MPa)
Any ideas as to how I can do this?
Thanks in advance

Answers (1)

Jan
Jan on 8 Dec 2016
Edited: Jan on 8 Dec 2016
What about simply dividing the values by 1e6?
x = rand(1, 20) * 1e7;
subplot(2,1,1);
plot(x);
ylabel('Pa');
subplot(2,1,2);
plot(x / 1e6)
ylabel('MPa')

Categories

Find more on Animation in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!