Home > Mobile >  How to change power in the axis of matlab?
How to change power in the axis of matlab?

Time:09-17

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

image

CodePudding user response:

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

CodePudding user response:

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.

  • Related