Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Advanced Plotting 2 (Example from Aj.Jim) ผศ. ดร. อนันต์ ผลเพิ่ม Anan Phonphoem

Similar presentations


Presentation on theme: "1 Advanced Plotting 2 (Example from Aj.Jim) ผศ. ดร. อนันต์ ผลเพิ่ม Anan Phonphoem"— Presentation transcript:

1 1 Advanced Plotting 2 (Example from Aj.Jim) ผศ. ดร. อนันต์ ผลเพิ่ม Anan Phonphoem http://www.cpe.ku.ac.th/~anan anan@cpe.ku.ac.th

2 2 Inventory Problem Here are projected sales for 10 weeks: Week: 1 2 34 5 6 7 8 9 10 Sales: 700 1100 800 800 1000 2200 1100 900 1000 1100 Each week the company can manufacture 1,000 units, and only sells units that are finished and "in stock". So the sales & inventory balance for week k is: Production = 1000 Sales(k) = minimum( ProjectedSales(k), Inventory(k) ) Inventory(k+1) = Inventory(k) + Production - Sales(k) Starting inventory at week 1 is 200. Compute the actual sales.

3 3 Inventory Problem Formulation 1.Formulate your solution method on paper. 2.Write a flow chart for your solution on paper. 3.Create an m-File to implement the flow chart.

4 4 Inventory Problem Solution (1) 3. Create an m-File to implement the flow chart. % Projected sales for each week psales = [ 700 1100 800 800 1000 2200 1100 900 1000 1100 ]; % Production each week production = 1000; % Initial inventory: inventory(1) = 200; % Inventory - sales - production balance for week k sales(k) = min( psales(k), inventory(k) ); inventory(k + 1) = inventory(k) + production - sales(k);

5 5 Inventory Problem Solution (2) 3b. Add a "for" loop for each week... % SalesForecast.m % Projected sales for each week psales = [700 1100 800 800 1000 2200 1100 900 1000 1100 ]; % Production each week production = 1000; % Initial inventory: inventory(1) = 200; % Inventory - sales balance for week k for k=1:10 sales(k) = min( psales(k), inventory(k) ); inventory(k + 1) = inventory(k) + production - sales(k); end

6 6 Inventory Problem Solution (3) Run the m-file and view the actual sales: >> SalesForecast >> sales sales = 200 1000 800 800 1000 1400 900 900 1000 1100 >> sum( sales ) ans = 9200 Too many numbers to interpret. What were the total sales?

7 7 Inventory Problem Solution (4) >> psales - sales ans = 500 100 0 0 0 800 100 0 0 0 How many sales were "lost" due to insufficient "stock"? Maybe we should hire some O.T. during week 1, 5, and 6 to increase production during those weeks?

8 8 Inventory Problem Solution (5) Plot proj. sales, actual sales, and inventory on one plot: >> week = 1:10 >> plot( week, psales, 'bo:', week, sales, 'gp--', week, inventory(1:10), 'rx' ) >> legend( 'projected sales', 'sales', 'inventory' )

9 9 Inventory Problem Solution (6) Plot projected sales, sales, and excess inventory. >> week = 1:10 >> plot( week, psales, 'bo:', week, sales, 'gp--', week, inventory(1:10)-sales, 'r^' ) >> legend( 'projected sales', 'sales', 'excess inventory' ) Hmmm... not much surplus inventory in weeks 6-10. If sales are high, we're in bad shape.


Download ppt "1 Advanced Plotting 2 (Example from Aj.Jim) ผศ. ดร. อนันต์ ผลเพิ่ม Anan Phonphoem"

Similar presentations


Ads by Google