Home > final > bisection_temp05line.m

bisection_temp05line

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 target = 70;
0002 K = 1:0.01:5;
0003 P = zeros(length(K));
0004 threshold = 0.005;
0005 for j=1:length(K)
0006     a = 0;
0007     b = 1;
0008     
0009     %find a b on the opposite side of the target
0010     [w, X] = fin05(0,4,0,4,0.1,10,10,b,K(j));
0011     while X < target
0012         b = b + 1;
0013         [w, X] = fin05(0,4,0,4,0.1,10,10,b,K(j));
0014     end
0015     
0016     [w_a,T_a] = fin05(0,4,0,4,0.1,10,10,a,K(j));
0017     [w_b,T_b] = fin05(0,4,0,4,0.1,10,10,b,K(j));
0018     %make sure that a and b are on opposite sides of the target
0019     if ( (T_a<target) && (T_b>target) )
0020         [w_c, T_c] = fin05(0,4,0,4,0.1,10,10,(a+b)/2.0,K(j));
0021         while abs(T_c - target)/2 > threshold
0022             if T_c < target
0023                 a = (a+b)/2.0;
0024             else
0025                 b = (a+b)/2.0;
0026             end
0027             [w_c, T_c] = fin05(0,4,0,4,0.1,10,10,(a+b)/2.0,K(j));
0028         end
0029     else
0030         disp('error: T_a and T_b on same side of target')
0031         K(j)
0032     end
0033     P(j) = (a+b)/2.0;
0034 end
0035 plot(K,P)

Generated on Mon 14-Apr-2014 16:57:11 by m2html © 2005