plot([ 1 2 3 ],[ 2 4 5 ]) x = 0:.5:7 x = Columns 1 through 3 0 0.500000000000000 1.000000000000000 Columns 4 through 6 1.500000000000000 2.000000000000000 2.500000000000000 Columns 7 through 9 3.000000000000000 3.500000000000000 4.000000000000000 Columns 10 through 12 4.500000000000000 5.000000000000000 5.500000000000000 Columns 13 through 15 6.000000000000000 6.500000000000000 7.000000000000000 y = sin(x) y = Columns 1 through 3 0 0.479425538604203 0.841470984807897 Columns 4 through 6 0.997494986604054 0.909297426825682 0.598472144103956 Columns 7 through 9 0.141120008059867 -0.350783227689620 -0.756802495307928 Columns 10 through 12 -0.977530117665097 -0.958924274663138 -0.705540325570392 Columns 13 through 15 -0.279415498198926 0.215119988087816 0.656986598718789 plot(x,y) x = 0:.01:7; y = sin(x); plot(x,y) xlabel('x-axis') ylabel('sin(x)') title('Simple sine plot') axis([-1 8 -2 2 ]) plot(x,y) z = cos(x); plot(x,z) hold on plot(x,y) plot(x,[y ;z ]) plot(x,y) hol don hold on plot(x,z,'r') legend('sin(x)','cos(x)') plot(x,y,':') plot(x,y,'--') plot(x,y,'.-') plot(x,y,'-.') plot(x,y,'-') plot(x,y,'k') plot(x,y,'k:') plot(x,y,'c:') plot(x,y,'g:') plot(x,y,'m:') help plot PLOT Linear plot. PLOT(X,Y) plots vector Y versus vector X. If X or Y is a matrix, then the vector is plotted versus the rows or columns of the matrix, whichever line up. If X is a scalar and Y is a vector, disconnected line objects are created and plotted as discrete points vertically at X. PLOT(Y) plots the columns of Y versus their index. If Y is complex, PLOT(Y) is equivalent to PLOT(real(Y),imag(Y)). In all other uses of PLOT, the imaginary part is ignored. Various line types, plot symbols and colors may be obtained with PLOT(X,Y,S) where S is a character string made from one element from any or all the following 3 columns: b blue . point - solid g green o circle : dotted r red x x-mark -. dashdot c cyan + plus -- dashed m magenta * star (none) no line y yellow s square k black d diamond w white v triangle (down) ^ triangle (up) < triangle (left) > triangle (right) p pentagram h hexagram For example, PLOT(X,Y,'c+:') plots a cyan dotted line with a plus at each data point; PLOT(X,Y,'bd') plots blue diamond at each data point but does not draw any line. PLOT(X1,Y1,S1,X2,Y2,S2,X3,Y3,S3,...) combines the plots defined by the (X,Y,S) triples, where the X's and Y's are vectors or matrices and the S's are strings. For example, PLOT(X,Y,'y-',X,Y,'go') plots the data twice, with a solid yellow line interpolating green circles at the data points. The PLOT command, if no color is specified, makes automatic use of the colors specified by the axes ColorOrder property. The default ColorOrder is listed in the table above for color systems where the default is blue for one line, and for multiple lines, to cycle through the first six colors in the table. For monochrome systems, PLOT cycles over the axes LineStyleOrder property. If you do not specify a marker type, PLOT uses no marker. If you do not specify a line style, PLOT uses a solid line. PLOT(AX,...) plots into the axes with handle AX. PLOT returns a column vector of handles to lineseries objects, one handle per plotted line. The X,Y pairs, or X,Y,S triples, can be followed by parameter/value pairs to specify additional properties of the lines. For example, PLOT(X,Y,'LineWidth',2,'Color',[.6 0 0]) will create a plot with a dark red line width of 2 points. Example x = -pi:pi/10:pi; y = tan(sin(x)) - sin(tan(x)); plot(x,y,'--rs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','g',... 'MarkerSize',10) See also plottools, semilogx, semilogy, loglog, plotyy, plot3, grid, title, xlabel, ylabel, axis, axes, hold, legend, subplot, scatter. Overloaded methods: timeseries/plot idmodel/plot idfrd/plot iddata/plot idnlhw/plot idnlarx/plot dspdata.plot Reference page in Help browser doc plot x = 0:.5:7; y = sin(x); plot(x,y) plot(x,y,':') plot(x,y,'.') plot(x,y,'.-') plot(x,y,'o') plot(x,y,'+') plot(x,y,'o-') plot(x,sin(x)) plot(x,x*x) {??? Error using ==> mtimes Inner matrix dimensions must agree. } clear all x = [ 1 2 3 ] x = 1 2 3 x*x {??? Error using ==> mtimes Inner matrix dimensions must agree. } x*x' ans = 14 x'*x ans = 1 2 3 2 4 6 3 6 9 x.*x ans = 1 4 9 x^2 {??? Error using ==> mpower Matrix must be square. } x.^2 ans = 1 4 9 x = 0:.5:7; plot(x,x.*x) plot(x,x+x) plot(x,x.^3) plot(x,sin(x^2)) {??? Error using ==> mpower Matrix must be square. } plot(x,sin(x.^2)) x = 0:.01:7; plot(x,sin(x.^2)) plot3(x,sin(x),cos(x)) x = 0:.01:25; plot3(x,sin(x),cos(x)) diary stuff exit