% % 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); {Warning: Failure at t=1.000000e+000. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-015) at time t.} > In ode45 at 371 In nsds_hw6_9a at 21 [n,m] = size(x); tauf = x(n,3), tauf = 49.1680 wf = x(n,2), wf = -0.8294 w0 = w0 - wf, w0 = -0.1706 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); {Warning: Failure at t=1.000000e+000. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-015) at time t.} > In ode45 at 371 In nsds_hw6_9a at 21 [n,m] = size(x); tauf = x(n,3), tauf = 1.4283 wf = x(n,2), wf = -0.0721 w0 = w0 - wf, w0 = -0.0986 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); [n,m] = size(x); tauf = x(n,3), tauf = 1.0405 wf = x(n,2), wf = -0.0036 w0 = w0 - wf, w0 = -0.0950 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); [n,m] = size(x); tauf = x(n,3), tauf = 1.0251 wf = x(n,2), wf = -1.6887e-004 w0 = w0 - wf, w0 = -0.0948 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); [n,m] = size(x); tauf = x(n,3), tauf = 1.0243 wf = x(n,2), wf = -8.0087e-006 w0 = w0 - wf, w0 = -0.0948 end dtaum = abs(taum - tauf); taum = tauf; wf = 1; while abs(wf) > 1e-4, x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); {Warning: Failure at t=1.000000e+000. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-015) at time t.} > In ode45 at 371 In nsds_hw6_9a at 21 [n,m] = size(x); tauf = x(n,3), tauf = 0.4287 wf = x(n,2), wf = 0.1989 w0 = w0 - wf, w0 = -0.2937 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); {Warning: Failure at t=1.000000e+000. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-015) at time t.} > In ode45 at 371 In nsds_hw6_9a at 21 [n,m] = size(x); tauf = x(n,3), tauf = 0.9506 wf = x(n,2), wf = 0.0290 w0 = w0 - wf, w0 = -0.3227 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); [n,m] = size(x); tauf = x(n,3), tauf = 0.9215 wf = x(n,2), wf = 0.0047 w0 = w0 - wf, w0 = -0.3274 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); [n,m] = size(x); tauf = x(n,3), tauf = 1.0862 wf = x(n,2), wf = 7.6500e-004 w0 = w0 - wf, w0 = -0.3282 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); [n,m] = size(x); tauf = x(n,3), tauf = 1.0889 wf = x(n,2), wf = 1.2552e-004 w0 = w0 - wf, w0 = -0.3283 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); [n,m] = size(x); tauf = x(n,3), tauf = 1.0893 wf = x(n,2), wf = 2.0604e-005 w0 = w0 - wf, w0 = -0.3283 end dtaum = abs(taum - tauf); taum = tauf; wf = 1; while abs(wf) > 1e-4, x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); {Warning: Failure at t=1.000000e+000. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-015) at time t.} > In ode45 at 371 In nsds_hw6_9a at 21 [n,m] = size(x); tauf = x(n,3), tauf = 1.2285 wf = x(n,2), wf = -0.0275 w0 = w0 - wf, w0 = -0.3009 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); {Warning: Failure at t=1.000000e+000. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-015) at time t.} > In ode45 at 371 In nsds_hw6_9a at 21 [n,m] = size(x); tauf = x(n,3), tauf = 1.1011 wf = x(n,2), wf = -0.0041 w0 = w0 - wf, w0 = -0.2967 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); [n,m] = size(x); tauf = x(n,3), tauf = 1.0825 wf = x(n,2), wf = -6.1347e-004 w0 = w0 - wf, w0 = -0.2961 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); [n,m] = size(x); tauf = x(n,3), tauf = 1.0803 wf = x(n,2), wf = -9.0830e-005 w0 = w0 - wf, w0 = -0.2960 end dtaum = abs(taum - tauf); taum = tauf; 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), tauf = 1.0664 wf = x(n,2), wf = 0.0036 w0 = w0 - wf, w0 = -0.2996 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); [n,m] = size(x); tauf = x(n,3), tauf = 1.0789 wf = x(n,2), wf = 5.3525e-004 w0 = w0 - wf, w0 = -0.3001 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); [n,m] = size(x); tauf = x(n,3), tauf = 1.0808 wf = x(n,2), wf = 8.0320e-005 w0 = w0 - wf, w0 = -0.3002 end dtaum = abs(taum - tauf); taum = tauf; 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), tauf = 1.0819 wf = x(n,2), wf = -1.9670e-004 w0 = w0 - wf, w0 = -0.3000 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); [n,m] = size(x); tauf = x(n,3), tauf = 1.0812 wf = x(n,2), wf = -2.9507e-005 w0 = w0 - wf, w0 = -0.3000 end dtaum = abs(taum - tauf); taum = tauf; 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), tauf = 1.0817 wf = x(n,2), wf = -1.5801e-004 w0 = w0 - wf, w0 = -0.2998 x0 = [ 0 , w0 , 1 ]; [sout,x] = ode45(@poiseuille,sigma,x0); [n,m] = size(x); tauf = x(n,3), tauf = 1.0811 wf = x(n,2), wf = -2.3689e-005 w0 = w0 - wf, w0 = -0.2998 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