%
%  w01line.m - simple line plot (djm: 05 jan 10)
%
%  save file as "w01line.m" (make sure that it is on the matlab path)
%  to run, type "w01line" at the matlab prompt ">>"
%

%  initialize workspace & set constants
clear;  close all

lambda = 1/(2*pi);
f_nu_t1 = 4*1*0.2;
f_nu_t2 = 4*1*1.0;

max_r  = 10;  dr = 0.2;

%  define a vector of r-values (type "r") to see the values
r = dr:dr:max_r;

%  calculate u(r) (note:  .* ./ .^ are elementwise arithmetic on a vector!)
%  for more info, type "help arith" and "u_theta1"
u_theta1 = (lambda./r) .* (1 - exp(-(r.^2)/f_nu_t1));
u_theta2 = (lambda./r) .* (1 - exp(-(r.^2)/f_nu_t2));

%  technicality!  add the origin to the plots (avoids divide by zero)
r = [0 , r];  u_theta1 = [0 , u_theta1];  u_theta2 = [0 , u_theta2];

%  plot & label axes (1=blue, 2=red)
clf
plot(r,u_theta1,'kx')
hold on
plot(r,u_theta1,'b-')
plot(r,u_theta2,'kx')
plot(r,u_theta2,'r-')

title('\bf my first matlab plot (figure 2.12, acheson)')
xlabel('\bf r-axis')
ylabel('\bf u_\theta(r) at times t=0.2 (blue) & t=1.0 (red)')
text(1.5,0.11,'\bf <-- not enough points up here! (to fix:  decrease "dr")')
