Change X & Y-Axis Scale in MATLAB

In summary, to change the scale of the X-axis in MATLAB, you can use the "xlim" function. To change the scale of the Y-axis to a logarithmic scale, you can use the "semilogy" or "loglog" functions. To adjust the spacing of tick marks on the X-axis, you can use the "xticks" function. It is possible to change the scale of both the X-axis and Y-axis at the same time using the "axis" function. In a 3D plot, you can change the scale of the axes using the "xlim", "ylim", and "zlim" functions.
  • #1
mathia
15
0
Hi,
how can i change x and y-axis scale to make sure that x and y-axis are on the same scale in matlab?
my x-axis is from 0 80 but the y-axis is from -3 to 5, so in plot the axis are not the same but i want to have same scale on both axis.
Thank you.
 
Physics news on Phys.org
  • #2
axis([xmin xmax ymin ymax])
 

1. How do I change the scale of the X-axis in MATLAB?

To change the scale of the X-axis in MATLAB, you can use the "xlim" function. This function allows you to specify the minimum and maximum values of the X-axis. For example, to set the X-axis scale from 0 to 10, you would use the command "xlim([0,10])".

2. Can I change the scale of the Y-axis to a logarithmic scale in MATLAB?

Yes, you can change the scale of the Y-axis to a logarithmic scale in MATLAB by using the "semilogy" function. This function plots the data on a logarithmic scale for the Y-axis while keeping the X-axis linear. You can also use the "loglog" function to plot both the X-axis and Y-axis on a logarithmic scale.

3. How do I adjust the spacing of tick marks on the X-axis in MATLAB?

To adjust the spacing of tick marks on the X-axis in MATLAB, you can use the "xticks" function. This function allows you to specify the positions of the tick marks on the X-axis. For example, if you want the tick marks to appear at every integer value from 0 to 10, you can use the command "xticks(0:10)".

4. Is it possible to change the scale of both the X-axis and Y-axis at the same time in MATLAB?

Yes, it is possible to change the scale of both the X-axis and Y-axis at the same time in MATLAB. You can use the "axis" function to set the limits for both axes in one command. For example, to set the X-axis scale from 0 to 10 and the Y-axis scale from 0 to 100, you can use the command "axis([0,10,0,100])".

5. Can I change the scale of the axes in a 3D plot in MATLAB?

Yes, you can change the scale of the axes in a 3D plot in MATLAB by using the "xlim", "ylim", and "zlim" functions. These functions allow you to specify the limits for the X-axis, Y-axis, and Z-axis, respectively. For example, to set the X-axis scale from 0 to 10, the Y-axis scale from 0 to 20, and the Z-axis scale from 0 to 30, you can use the command "xlim([0,10]), ylim([0,20]), zlim([0,30])".

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
892
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
56
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
463
Back
Top