axis limits matlab

To set the axis limits in MATLAB, you can use the xlim and ylim functions for the x-axis and y-axis, respectively. Here's how you can use them:

x = 1:10;
y = sin(x);

% Set the x-axis limits
xlim([2, 8])

% Set the y-axis limits
ylim([-1, 1])

This code sets the x-axis limits to be between 2 and 8, and the y-axis limits to be between -1 and 1. You can adjust the values in the square brackets to set the desired limits for your plot.