%
%  code01.m -- 08 sept 02 -- djm
%
%  minimal plotting code
%
%  - to run, type "code01" at the matlab prompt ">>"
%  - for help on a command "dothis", type "help dothis"

%  clear workspace & graphics ("help clear", etc)

clear;  close all

%  set vector of x-points (minimum 50 points for a smooth plot)
%   - semicolon (";") at line end suppresses screen write (try it without!)

x = 0:0.1:10;

%  DOING ARITHMETIC
%  calculate y-values (note mult, div & powers are .* and ./ and .^)

y = x./(1 + x.^2);

%  plot line graphs

figure(1);  hold on
plot(x,y,'k')
plot(x,y,'rx')
axis([-0.1 10.1 -0.1 0.6]);

%  label plot ("\bf"-prefix makes text boldface)

title(['\bf my first plot'])
xlabel('x-axis')
ylabel('y-axis')
text(5,0.1,'y = x/(1+x^2)')
text(1,0.55,'local max at (1,0.5)')
