axis leignth in matlab

To set the axis length in MATLAB, you can use the axis function with four input arguments, which represent the minimum and maximum values of the x- and y-axis:

main.m
axis([xmin xmax ymin ymax])
28 chars
2 lines

For example, if you want to set the x-axis limit from 0 to 10 and the y-axis limit from 0 to 20, you can use the following code:

main.m
x = linspace(0,10);
y = 2*x;
plot(x, y);
axis([0 10 0 20]);
60 chars
5 lines

This will produce a plot where the x-axis goes from 0 to 10 and the y-axis goes from 0 to 20.

related categories

gistlibby LogSnag