The following files are provided in this package: README.txt (this file) matching3PH.m matching3EC.m matching3PH2.m convolutionofPH.m mixtureofPH.m isPH2.m momentofPH.m -- matching3PH.m This is the main source code of the moment matching algorithm. % Usage: [tau,T] = matching3PH(momentsofG) % % INPUT, momentsofG, is a vector of size 3. % An example of an input is: % % momentsofG = [2,6,24]; % % OUTPUT, [tau,T], is a pair of a vector and a matrix. % When the input is [2,6,24], the output is % % tau = [1,0]; % % T = [-1 1; % 0 -1]; % % Yes. This is an Erlang-2 distribution with mean 2. % % Given first three moments, momentsofG, % the function returns a PH distribution, (tau,T), whose % first three moments is momentsofG. % The output PH distribution has no mass probability at zero. % That is the sum of all the elements of tau is 1. % % The function is not defined everywhere, but almost everywhere. % When the function is not defined for the input, it perturbs % the input and returns a PH distribution that has the first three % moments close to the input. The error is very small for most % practical purposes. % % When the output is (0,0), there was an error in the function % or the input was illegal. The following code is used in matching3PH.m: matching3EC.m matching3PH2.m convolutionofPH.m mixtureofPH.m isPH2.m Each file has a useful function in its own right. Among them, matching3EC.m is important in terms of moment matching. It takes the first three moments and returns a PH distribution. It is defined everywhere. It sometimes returns a PH distribution with fewer phases, and never returns one with more phases than matching3PH. The output PH distribution sometimes has a mass probability at zero. That is the sum of the elements of tau may be less than 1. momentsofPH.m This may be used to check the accuracy of the moment matching algorithms. It has an opposite function. The input is a PH distribution and an integer k. The output is the k-th moment of the input PH distribution.