Home > final > bisection_temp05.m

bisection_temp05

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 T = 50:1:120;
0002 K = 1:0.01:5;
0003 P = zeros(length(T),length(K));
0004 threshold = 0.5;
0005 for i=1:length(T)
0006     target = T(i);
0007     for j=1:length(K)
0008         a = 0;
0009         b = 1;
0010         
0011         %find a b on the opposite side of the target
0012         [w, X]= fin05(0,4,0,4,0.1,10,10,b,K(j));
0013         while X < target
0014             b = b + 1;
0015             [w, X]= fin05(0,4,0,4,0.1,10,10,b,K(j));
0016         end
0017     
0018         [w_a,T_a] = fin05(0,4,0,4,0.1,10,10,a,K(j));
0019         [w_b,T_b] = fin05(0,4,0,4,0.1,10,10,b,K(j));
0020         %make sure that a and b are on opposite sides of the target
0021         if ( (T_a<target) && (T_b>target) )
0022             [w_c, T_c] = fin05(0,4,0,4,0.1,10,10,(a+b)/2.0,K(j));
0023             while abs(T_c - target)/2 > threshold
0024                 if T_c < target
0025                     a = (a+b)/2.0;
0026                 else
0027                     b = (a+b)/2.0;
0028                 end
0029                 [w_c, T_c] = fin05(0,4,0,4,0.1,10,10,(a+b)/2.0,K(j));
0030             end
0031         else
0032             disp('error: T_a and T_b on same side of target')
0033             K(j)
0034         end
0035         P(i,j) = (a+b)/2.0;
0036     end
0037 end
0038 mesh(K,T,P);
0039 title('Dependence of Power on Thermal Conductivity and Temperature');
0040 xlabel('Thermal Conductivity [W / cm*C]');
0041 ylabel('Max Temperature [C]');
0042 zlabel('Power [W]');

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