MATLAB Defining Axes in Matlab plotting

Click For Summary
In this discussion, a user seeks assistance with plotting in MATLAB, specifically wanting to set vertical axis limits for a variable 'u' while keeping the horizontal axis defined. The user has defined 'u' and is using the 'axis' command to set limits but finds that the vertical limits are not being applied correctly. Other participants suggest using the 'axis' command with specific parameters to define both x and y limits. They clarify that to maintain the x-axis limits while setting the y-axis limits, the command should be structured as 'axis([xlim ymin ymax]'. The user reports that their current implementation does not reflect the desired y-axis limits, indicating a potential issue with how the axis limits are being applied in their code.
adnan jahan
Messages
93
Reaction score
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
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])
 
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])
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K