moments (MatLab R2007b)

Needed by STFruin05.m

Download File

Click the button to demonstrate a graph view. 
Notice: This content requires Java Runtime Environment.
Java Applet and JavaScript should be allowed on your browser.

Fri, May 04 2012 by Dedy Dwi Prastyo


function [ mk ] = moments( k,dparameters );
    % k: order of moment to calculate
	% dparameters: list, composed of 2 vectors containing the parameters of loss distribution, weights (first vector) and exponential parameters (second vector)
    p1=dparameters(:,1); % weights
    p2=dparameters(:,2); % exponential parameters
   if (k==1)
    mk=sum(p1./p2);
   elseif (k==2)
    mk=2*sum(p1./(p2.^2));
   elseif (k==3)
	mk=6*sum(p1./(p2.^3));
   elseif (k==4)
    mk=24*sum(p1./(p2.^4));
   else
       disp('k chosen too large')
end