>> x = -10:.1:10; >> plot( x.^2 ) >> plot( x, x.^2 ) >> plot( x.^2, x )Note that x must be assigned values, before the plot command is issued [although you could use plot( (-10 : .1 : 10) .^ 2 ) if you really really wanted to].
>> plot( x, x.*sin(x) ) >> plot( x.*cos(x), x.*sin(x) ) >> comet( x.*cos(x), x.*sin(x) )Functions of two variables may be plotted, as well, but some "setup" is required!
>> [x y] = meshgrid(-3:.1:3, -3:.1:3); >> z = x.^2 - y.^2; >> mesh(x,y,z) >> surf(x,y,z) >> contour(z) >> help sliceThere's a very interesting example, in the help page for slice; use the mouse to cut and paste it to the matlab prompt.
The following commands bring up lists of useful graphics commands [each has a help page of its own].
>> help plotxy >> help plotxyz >> help graphicsTo print Matlab graphics, just enter "print" at the Matlab prompt; the current figure window will be sent to the printer. On some systems, it is necessary to set the environment variable PRINTER, before starting Matlab. This is done by typing, at the Unix prompt:
% setenv PRINTER=myprinter [for C shell]or
$ PRINTER=myprinter; export PRINTER [for Bourne shell]