Contents

Aaron Klapheck

% Assignment # 4
clear, clc
date
ans =

26-Sep-2007

Problem 20

% L is the length, R is the radious, and A is the area. (see figure P20)
% Area is also equal to 2*R*L + 1/2*pi*R^2.
% Min_Cost is the minimum the fence will cost.

A = 1600                        % Measured in square feet.
R = [0: 0.01: 100];             % Set up correct incrament.
L = (2*A - pi*R.^2)./(4*R);     % Solve area equation for L.
Cost = 2*(L+R)*30 + pi*R*40;    % The cost of the fence.

[Min_Cost, Index] = min(Cost)   % Mimimize the cost.

R = R(Index)                    % R value for mimimum cost.

L = L(Index)                    % L value for mimimum cost.
A =

        1600

Warning: Divide by zero.

Min_Cost =

  5.1575e+003


Index =

        1862


R =

   18.6100


L =

   28.3714

Problem 21a

% Given:
% 1. the geometric sequence g(x) = 1,x,x^2,x^3,x^4,..., .
% 2. If abs(a) < 1, then g(x) converges to 1/(1-x).

% a. given x = 0.63, compute the sum of the first
% 1. 11 terms
% 2. 51 terms
% 3. 101 terms
% Compair these three values with the limit value.

x = 0.63

Converg = 1/(1-x)               % What the series actually convergest to.

% a. for 11 terms.
Exponants = [0:1:11]
Power_Series = x.^Exponants
Sum = sum(Power_Series)

% Compair, evaluates how far off part a. is comparied to the convergent
% value.
Compair = Converg - Sum


% a. for 51 terms.
Exponants = [0:1:51]
Power_Series = x.^Exponants
Sum = sum(Power_Series)

% Compair, evaluates how far off part a. is comparied to the convergent
% value.
Compair = Converg - Sum

% a. for 101 terms.
Exponants = [0:1:101]
Power_Series = x.^Exponants
Sum = sum(Power_Series)

% Compair, evaluates how far off part a. is comparied to the convergent
% value.
Compair = Converg - Sum
x =

    0.6300


Converg =

    2.7027


Exponants =

     0     1     2     3     4     5     6     7     8     9    10    11


Power_Series =

  Columns 1 through 9 

    1.0000    0.6300    0.3969    0.2500    0.1575    0.0992    0.0625    0.0394    0.0248

  Columns 10 through 12 

    0.0156    0.0098    0.0062


Sum =

    2.6921


Compair =

    0.0106


Exponants =

  Columns 1 through 16 

     0     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15

  Columns 17 through 32 

    16    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31

  Columns 33 through 48 

    32    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47

  Columns 49 through 52 

    48    49    50    51


Power_Series =

  Columns 1 through 9 

    1.0000    0.6300    0.3969    0.2500    0.1575    0.0992    0.0625    0.0394    0.0248

  Columns 10 through 18 

    0.0156    0.0098    0.0062    0.0039    0.0025    0.0016    0.0010    0.0006    0.0004

  Columns 19 through 27 

    0.0002    0.0002    0.0001    0.0001    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 28 through 36 

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 37 through 45 

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 46 through 52 

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000


Sum =

    2.7027


Compair =

  9.9428e-011


Exponants =

  Columns 1 through 16 

     0     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15

  Columns 17 through 32 

    16    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31

  Columns 33 through 48 

    32    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47

  Columns 49 through 64 

    48    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63

  Columns 65 through 80 

    64    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79

  Columns 81 through 96 

    80    81    82    83    84    85    86    87    88    89    90    91    92    93    94    95

  Columns 97 through 102 

    96    97    98    99   100   101


Power_Series =

  Columns 1 through 9 

    1.0000    0.6300    0.3969    0.2500    0.1575    0.0992    0.0625    0.0394    0.0248

  Columns 10 through 18 

    0.0156    0.0098    0.0062    0.0039    0.0025    0.0016    0.0010    0.0006    0.0004

  Columns 19 through 27 

    0.0002    0.0002    0.0001    0.0001    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 28 through 36 

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 37 through 45 

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 46 through 54 

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 55 through 63 

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 64 through 72 

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 73 through 81 

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 82 through 90 

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 91 through 99 

    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

  Columns 100 through 102 

    0.0000    0.0000    0.0000


Sum =

    2.7027


Compair =

  8.8818e-016

Problem 24

% see Figure P24 on page 130.
% Goal: maximize Power source(P_l) for given values of voltage source (v_s)
% and reistance source (R_s).
% Power load (P_l) and resistance load (R_l) also play a role.

% Equation: P_l = (R_l)./(R_s + R_l).*v_s.^2.

% To maximize P_l we need to maximize R_ratio = (R_l)./(R_s + R_l)

% Possible values of R_s are 10, 15, 20, or 25 ohm's
% Possible values of R_l are 10, 15, 20, 25, or 30 ohm's

% For each value of R_s, find R_l such that it maximizes the power
% transfer.

R_s = [10:5:25]
R_l = [10:5:30]

[R_s_matrix, R_l_matrix] = meshgrid(R_s, R_l)

% For each column of x: R_s is constant and R_l varies.
x = R_l_matrix./(R_s_matrix+R_l_matrix).^2

[value, index] = max(x)

% The first row consists of the given values of R_s.
% The second column consists of the values of R_l that maximize the
% power for given values of R_s listed above it.
matrix_answer = [R_s; R_l(index)]
R_s =

    10    15    20    25


R_l =

    10    15    20    25    30


R_s_matrix =

    10    15    20    25
    10    15    20    25
    10    15    20    25
    10    15    20    25
    10    15    20    25


R_l_matrix =

    10    10    10    10
    15    15    15    15
    20    20    20    20
    25    25    25    25
    30    30    30    30


x =

    0.0250    0.0160    0.0111    0.0082
    0.0240    0.0167    0.0122    0.0094
    0.0222    0.0163    0.0125    0.0099
    0.0204    0.0156    0.0123    0.0100
    0.0187    0.0148    0.0120    0.0099


value =

    0.0250    0.0167    0.0125    0.0100


index =

     1     2     3     4


matrix_answer =

    10    15    20    25
    10    15    20    25

Problem 27

A = [11, 5; -9, -4]
B = [-7, -8; 6, 2]

Products_AB = A*B

Products_BA = B*A
A =

    11     5
    -9    -4


B =

    -7    -8
     6     2


Products_AB =

   -47   -78
    39    64


Products_BA =

    -5    -3
    48    22

Problem 29

% For Unit_Production_Cost: The rows corrospond to products 1 through 5.
% Column 1 is for Materials, column 2 is for Labor, column 3 is for
% Transportation. Measured in $*10^3.
Unit_Production_Cost = [7, 3, 2; 3, 1, 3; ...
    9, 4, 5; 2, 5, 4; 6, 2, 1]

% For Quarterly_Production_Volume: The rows corrospond to products 1
% through 5. Columns 1 through 4 corrospond to Quarters 1 through 4.
Quarterly_Production_Volume = [16, 14, 10, 12; 12, 15, 11, 13; ...
    8, 9, 7, 11; 14, 13, 15, 17; 13, 16, 12, 18]


% For Quarterly_Costs: Each column represents the cost for each quarter.
% Each row represents the cost of materials, labor, and transportation
% respectively.
Quarterly_Costs = Unit_Production_Cost'*Quarterly_Production_Volume   % a.

% For Total_Cost_By_Quarter: Each column represents the total amount
% spent for each quarter.
Total_Cost_By_Quarter = sum(Quarterly_Costs)                % b.

Total_Cost = sum(Total_Cost_By_Quarter)                     % c.
Unit_Production_Cost =

     7     3     2
     3     1     3
     9     4     5
     2     5     4
     6     2     1


Quarterly_Production_Volume =

    16    14    10    12
    12    15    11    13
     8     9     7    11
    14    13    15    17
    13    16    12    18


Quarterly_Costs =

   326   346   268   364
   188   190   168   214
   177   186   160   204


Total_Cost_By_Quarter =

   691   722   596   782


Total_Cost =

        2791