**Product Cost Analysis**

shows the costs associated with a certain product, and shows the production volume for the four quarters of the business year. Use MATLAB to find the quarterly costs for materials, labor, and transportation; the total material, labor, and transportation costs for the year; and the total quarterly costs.

**Solution**

The costs are the product of the unit cost times the production volume. Thus we define two . matrices: U contains the unit costs in Table 2.4-2 in thousands of dollars, and P contains the quarterly production data in Table 2.4-3.

»U [6, 2, 1; 2 , 5, 4; 4, 3, 2; 9, 7, 3];

»P = [10, 12, 13, 15;8, 7, 6, 4;12.,10,13,9;6,4,11. 5];

Note that if we multiply the first column in u times the first lumn in P, we obtain the total materials cost for the first cuarter, Similarly, multiplying the first column in

utimes the second column in P gives the total materials cost for the second quarter. Also, multiplying the second column in U times the first column in P gives the total labor cost for the first quarter, and so on. Extending this pattern, we can see that we must multiply the transpose of u times P. This multiplication gives the cost matrix C.

Each column in C represents one quarter. The total first-quarter cost is the sum of the elements in the first column, the second-quarter cost is the sum of the second column, and so on. Thus because th~ sum command sums the columns of a matrix, the quarterly costs are obtained by typing:’

»Quarterly_Costs = sum(C) ,

The resulting vector, containing the quarterly costs in thousands of dollars, is

[400 351 509 355]. Thus the total costs in each quarter are $400,000; $351,000; $509,000;and $355,000. . The elements in the first row of C are the material costs for each quarter; the elements in the setond row are the labor costs, and .se in thJ’third row are the transportation costs. Thus to find the total material costs, we must sum ac,ross the first row of C. Similarly, the total labor and total transportation costs are the sums across the second and third rows of C. Because ftJe sum command sums columns. we’~ust use the transpose of C. Thus we

type the following: »Category_Costs = sum(C’)

T;he resulting vector, containing the category costs in thousands of dollars, is [760 539 316]. Thus the total material cos~tIsS;;f·6,rt”he year. are $760,000; the labor costs are $539,000; and the transportation costs are $31″6,000. We displayed the matrix C only to interpret its structure. If we need not display C,

the entire analysis would consist of only four command lines.

»U = [6, 2, 1;2, 5, 4; 4, 3, 2; 9, 7, 3];

»P = [10, 12, 13, 15;8, 7, 6, 4;12, 10, 13, 9;6, 4, 11,

»Quarterly_Costs = sum(U’*P)

Quarterly_Costs =

400 351 509 355

»Category_Costs = sum«U’~P) ‘)

Category_Costs. =

760 539 316

5] ;

This example illustrates the compactness of MATLAB commands.