Question: Case 4 matlab code to call function % Case 4: Given a history of weekly sales and a weekly production process, % each a random

Case 4 matlab

code to call function

% Case 4: Given a history of weekly sales and a weekly production process,

% each a random distribution, find the storage history.

% INPUTS:

% salesSet, set of weekly sales data

% prodSet, set of weekly production levels

% OUTPUTS:

% storageInit, initial storage level, before week 1

% storageSet, weekly storage levels

% storageMean, mean of weekly storage levels

% storageStdDev, standard deviation of weekly storage levels

% -------------------------------------------------------------------------

% SETUP SECTION -----------------------------------------------------------

load('Case4Data'); % Loads a sample salesSet and prodSet

% SIMULATION SECTION ------------------------------------------------------

[storageInit,storageSet,storageMean,storageStdDev]= Sales_4_fcn(salesSet,prodSet);

% REPORT SECTION ----------------------------------------------------------

% setup conditions

fprintf(' Setup 4: ');

fprintf(' nweeks=%6.0f ',nweeks);

fprintf(' mus= %6.0f ',mus);

fprintf(' sigmas= %6.0f ',sigmas);

fprintf(' mup= %6.0f ',mup);

fprintf(' sigmap= %6.0f ',sigmap);

salesMean= mean(salesSet);

fprintf(' salesMean= %6.0f ',salesMean);

salesStdDev= std(salesSet);

fprintf(' salesStdDev= %6.0f ',salesStdDev);

prodMean= mean(prodSet);

fprintf(' prodMean= %6.0f ',prodMean);

prodStdDev= std(prodSet);

fprintf(' prodStdDev= %6.0f ',prodStdDev);

% results

fprintf(' Results 4: ');

fprintf(' storageInit= %6.0f ',storageInit);

fprintf(' storageMean= %6.0f ',storageMean);

fprintf(' storageStdDev= %6.0f ',storageStdDev);

storageMin= min(storageSet);

fprintf(' storageMin= %6.0f ',storageMin);

storageMax= max(storageSet);

fprintf(' storageMax= %6.0f ',storageMax);

% plot results

figure(1)

x= 1:1:nweeks;

subplot(3,1,1)

plot(x,storageSet);

grid on;

% hold on;

% xline= [1,nweeks];

% yline= [storageMean,storageMean];

% plot(xline,yline,'k')

% hold off;

%xlabel('weeks');

ylabel('storage level');

title('Case 4: Sales and production levels, random.');

subplot(3,1,2)

plot(x,salesSet,x,prodSet);

grid on;

legend('sales','prod');

% hold on;

% xline= [1,nweeks];

% yline= [salesMean,salesMean];

% plot(xline,yline,'k')

% hold off;

xlabel('weeks');

ylabel('sales,prod');

subplot(3,1,3)

netstore= prodSet -salesSet;

plot(x,netstore);

grid on;

%xlabel('weeks');

ylabel('netstore= prod-sales');

fprintf(' ');

% -------------------------------------------------------------------------Case 4 matlab code to call function % Case 4: Given a

Given weekly sales data and a variable production process, find the storage history and estimate long-term storage needs. Assume the initial ammount of widgets in storage is equal to 50% of the mean of the production set. Inputs and outputs of the function are as follows: % INPUTS: % salesset, set of weekly sales data % prodset, set of weekly production levels % OUTPUTS: % storageInit, initial storage level, before week 1 % storageSet, weekly storage levels storageMean, mean of weekly storage levels % storageStdDev, standard deviation of weekly storage levels Function C Reset MATLAB Documentation 1 function (storageInit, storageSet, storageMean, storagestdDev]= Sales_4_fcn(salesset, prodset) 2 % copy and paste your code here 3 % IMPORTANT NOTE: Assume storageInit= 0.5* mean(prodset) end Given weekly sales data and a variable production process, find the storage history and estimate long-term storage needs. Assume the initial ammount of widgets in storage is equal to 50% of the mean of the production set. Inputs and outputs of the function are as follows: % INPUTS: % salesset, set of weekly sales data % prodset, set of weekly production levels % OUTPUTS: % storageInit, initial storage level, before week 1 % storageSet, weekly storage levels storageMean, mean of weekly storage levels % storageStdDev, standard deviation of weekly storage levels Function C Reset MATLAB Documentation 1 function (storageInit, storageSet, storageMean, storagestdDev]= Sales_4_fcn(salesset, prodset) 2 % copy and paste your code here 3 % IMPORTANT NOTE: Assume storageInit= 0.5* mean(prodset) end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!