Sultan1011
Sultan1011

Reputation: 43

How to change power in the axis of matlab?

I want the scale to be x10^10 not 10^9. How can I change this.

image

Upvotes: 2

Views: 1128

Answers (2)

Daniel Melendrez
Daniel Melendrez

Reputation: 424

Consider this example:

x = linspace(0,5,1000);
y = 10^10*(exp(x).*sin(20*x));
plot(x,y)

grid on
grid minor

which produces the following plot with automatic limits:

enter image description here

by modifying the axes properties, you can define your own exponent:

ax = gca;
ax.YAxis.Exponent = 10;

obtaining this:

enter image description here

Please read the Matlab documentation for further explanation

Upvotes: 1

Cris Luengo
Cris Luengo

Reputation: 60695

There might be an axes property for this, I don’t know. But the simple solution is to plot y * 1e-10, and then add the “10^10” in the axis label, next to the units (“H2 Volume in Reservoir (10^10 m^3)”). I have always preferred it that way, and it is the more common way to present data.

Note that you can use LaTeX formatting in axis labels to properly show powers and so on.

Upvotes: 0

Related Questions