use axis function to adjust limits r axis from minimum value of r to the maximum value of r in matlab

You can use the axis function in MATLAB to adjust the limits of the R-axis. To set the minimum and maximum limits of the R-axis to the minimum and maximum values of R, you can use the min() and max() functions, respectively. Here's an example:

main.m
% Example data
R = [1 2 3 4 5];
theta = [pi/4 pi/3 pi/2 2*pi/3 3*pi/4];
X = R.*cos(theta);
Y = R.*sin(theta);

% Plot the data
plot(X, Y);

% Adjust the limits of the R-axis
rMin = min(R);  % minimum value of R
rMax = max(R);  % maximum value of R
axis([rMin rMax -rMax rMax]);  % [xmin xmax ymin ymax]
303 chars
14 lines

In the example above, we first define some example data R, theta, X, and Y. We then plot the data using plot(X, Y). Finally, we adjust the limits of the R-axis using axis([rMin rMax -rMax rMax]), where rMin is the minimum value of R and rMax is the maximum value of R. The second and third elements in the array specify the limits of the theta-axis (in this example, we set it to -rMax and rMax, respectively).

gistlibby LogSnag