Skip to content

Instantly share code, notes, and snippets.

@tieubinhco
Last active December 25, 2020 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tieubinhco/4f75c6f64e31215941666058061ecac2 to your computer and use it in GitHub Desktop.
Save tieubinhco/4f75c6f64e31215941666058061ecac2 to your computer and use it in GitHub Desktop.
MATLAB script to calculate Economic Order Quantity Model (EOQ)
clear
clc
%syms Q H S P D
D=40*10^6;
S=10000;
H=0.1;
P=5;
Working_days=250; %(days)
Lag_time=7; %(days)
%syms Q
%Q=linspace(0,10^9,10000);
EOQ=sqrt(2*S*D/H);
Q=EOQ;
Total_Order_Cost=(D/Q)*S;
Total_Holding_Cost=(Q/2)*H;
Capital_Cost=P*D;
TC=Total_Order_Cost+Total_Holding_Cost+Capital_Cost;
d=D/Working_days; %Demand on 1 day
R=d*Lag_time; %Reordering point
T=Q/d; %Ordering Cycle
%fplot(TC,[0,1000])
%% Display values
EOQ
Total_Holding_Cost
TC
d
R
T
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment