There are several ways to use xlim to adjust the x limits of
a plot. The y-axis retains its current limits. The four
syntaxes are
xlim([lo,hi])
xlim(lo,hi)
xlim('auto')
xlim auto
where in the first two forms, the new x-limits on the plot are
[lo,hi]. In the second two forms, the axes limits are
automatically selected by FreeMat.
Here is an example of using xlim to zoom in on the x axis of a
plot without changing the y limits. First, the plot with default
limits
--> x = linspace(-1,1); --> y = sin(2*pi*x); --> plot(x,y,'r-');
which results in
Next, we zoom in on the plot using the xlim function
--> plot(x,y,'r-') --> xlim(-0.2,0.2)
which results in