MATLAB Plot Command


Jump to: navigation, search
MATLAB Plot Command
Green carrot left.gif
All MATLAB Articles Figures in MATLAB
Green carrot.jpg
In order to prevent spam, users must register before they can edit or create articles.

1 Introduction

The plot command plots 2D data linearly to the current axis on the current figure.

2 Usage

Here's how a plot can be created.

 >> h = figure;                                   % Create new figure and save the handle to h
 >> x = [0:0.001:10];                         % Create x vector
 >> y= sin(x);
 >> plot(x, y)                                      % Plot
 >> title('Sine wave from 0 to 10')        % Set the title of the current axis
 >> ylabel('sin(x)')                              % Set the label for the y-axis
 >> xlabel('x')
 >> grid on                                         % Turn on the grid