%  This function solves the first part of homework problem [H6.9]
%  --------------------------------------------------------------
%
echo on
diary nsds_hw6_9a.dry
%
%  We need to set up the initial guesses for w0 and for taum
%
global taum
taum = 2;
w0 = -1;
%
%  Loop until the target is hit.
%
sigma = 0:0.01:1;
dtaum = 1;
while dtaum > 1e-4,
  wf = 1;
  while abs(wf) > 1e-4,
    x0 = [ 0 , w0 , 1 ];
    [sout,x] = ode45(@poiseuille,sigma,x0);
    [n,m] = size(x);
    tauf = x(n,3),
    wf = x(n,2),
    w0 = w0 - wf,
  end
  dtaum = abs(taum - tauf);
  taum = tauf;
end
%
%  Plot the results.
%
vhat = x(:,1);
w = x(:,2);
tau = x(:,3);
rho = ones(size(sout)) - sout;
subplot(3,1,1)
plot(rho,vhat)
grid on
title('ttt')
xlabel('xxx')
ylabel('yy1')
subplot(3,1,2)
plot(rho,w)
grid on
xlabel('xxx')
ylabel('yy2')
subplot(3,1,3)
plot(rho,tau)
grid on
xlabel('xxx')
ylabel('yy3')
print -deps nsds_hw6_9a.eps
%
diary off
echo off
%
return