Home > final > bisection_temp04.m

bisection_temp04

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 a = 0;
0002 b = 1;
0003 target = 80.0;
0004 threshold = 0.000005;
0005 M = 50; N = 50;
0006 %find a b on the opposite side of the target
0007 while max(fin04(0,4,0,4,0.1,M,N,b)) < target
0008     b = b + 1;
0009 end
0010 [w_a,T_a] = fin04(0,4,0,4,0.1,M,N,a);
0011 [w_b,T_b] = fin04(0,4,0,4,0.1,M,N,b);
0012 %make sure that a and b are on opposite sides of the target
0013 if ( (T_a<target) && (T_b>target) )
0014     [w_c, T_c] = fin04(0,4,0,4,0.1,M,N,(a+b)/2.0);
0015     while abs(T_c - target)/2 > threshold
0016         if T_c < target
0017             a = (a+b)/2.0;
0018         else
0019             b = (a+b)/2.0;
0020         end
0021         [w_c, T_c] = fin04(0,4,0,4,0.1,M,N,(a+b)/2.0);
0022     end
0023 end
0024 power = (a+b)/2.0;
0025 [w,T] = fin04(0,4,0,4,0.1,M,N,power);
0026 h = (4-0)/M; k = (4-0)/N;
0027 x = 0+(0:M)*h;
0028 y = 0+(0:N)*k;
0029 figure(1);
0030 mesh(x,y,w');
0031 title(['Cooling Fin (Copper) - Power (W): ' num2str(power,4) ' Max Temp. (C): ' num2str(T,4)]);
0032 xlabel('Fin Length (cm)');
0033 ylabel('Fin Length (cm)');
0034 zlabel('Temperature (C)');
0035 view(0,90);
0036 figure(2);
0037 mesh(x,y,w');
0038 title(['Cooling Fin (Copper) - Power (W): ' num2str(power,4) ' Max Temp. (C): ' num2str(T,4)]);
0039 xlabel('Fin Length (cm)');
0040 ylabel('Fin Length (cm)');
0041 zlabel('Temperature (C)');
0042 view(-200,30);

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