Defining Axes in Matlab plotting

In summary, the conversation is about defining the limitation of u along the vertical axis in a matlab plot. One person suggests using the axis command to explicitly define the ranges, while another person mentions that the previous thread had instructions on how to define the axes. The code provided does not give the desired limitation on the y axis.
  • #1
adnan jahan
96
0
Dear Fellows,

I am plotting in matlab, and defined and axis along horizontal in such a way
x=0:0.2:1.2;
for
plot (x, u,'re--' )
but I need to define the limitation of u along vertical axis,,,,


can anyone suggest me the exact for range -5 to +1

Regards
 
Physics news on Phys.org
  • #2
well, you need to define u first, have you done that? I told you how to explicitly define the axes themselves in the other other thread where you asked this question, but if you're just looking at defining the ranges you can use the axis command:

axis([xmin xmax ymin ymax])

if you don't want to change the x limits, it's:

axis([xlim ymin ymax])
 
  • #3
I have define the function u,
x=0:0.2:1.2;
axis([xlim 0 100])
plot (x, u,'re--' )
does not give any limitation of y axis,,,, all values are same as the one got without axis([xlim 0 100])
 

Related to Defining Axes in Matlab plotting

1. What is the purpose of defining axes in Matlab plotting?

Defining axes in Matlab plotting allows you to customize the appearance of your plot, such as the range and scale of the axes, the labels, and the tick marks. It also allows you to plot multiple graphs on the same axes for easier comparison.

2. How do I set the range of the axes in Matlab?

To set the range of the axes, you can use the xlim and ylim functions. For example, to set the x-axis range from -10 to 10, you would use xlim([-10, 10]). You can also use axis([xmin, xmax, ymin, ymax]) to set the range for both the x and y axes at once.

3. How can I change the labels on the axes?

To change the labels on the axes, you can use the xlabel and ylabel functions for the x and y axes respectively. You can also use title to add a title to your plot. All of these functions allow you to specify the text for the labels.

4. Can I change the scale of the axes in Matlab?

Yes, you can change the scale of the axes by using the xscale and yscale functions. These functions allow you to specify a logarithmic scale, which can be useful for plotting data with a large range of values.

5. How do I add grid lines to my plot?

You can add grid lines to your plot by using the grid on command. This will add grid lines to both the x and y axes. If you only want grid lines on one axis, you can use grid on x or grid on y. To remove grid lines, you can use grid off.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
162
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
975
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
Back
Top