[h1] = plot (x,y) in matlab

In MATLAB, the plot function is used for 2D visualization. Below is the syntax to create a 2D line plot using the plot function:

% Create the x and y data
x = 1:10;
y = sin(x);

% Plot the data
h1 = plot(x, y);
82 chars
7 lines

The output h1 is a handle to the plotted line. You can use the handle to modify the line properties, such as color and line width.

related categories

gistlibby LogSnag