www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/Create2DLinePlotExample.m

    %% Create 2-D Line Graph
% This example shows how to create a simple line graph. Use the |linspace|
% function to define |x| as a vector of 100 linearly spaced values between
% 0 and $2\pi$.

% Copyright 2015 The MathWorks, Inc.


x = linspace(0,2*pi,100);

%%
% Define |y| as the sine function evaluated at the values in |x|.

y = sin(x);

%%
% Plot |y| versus the corresponding values
% in |x|.

figure
plot(x,y)