MATLAB does not have a built-in dF Plot. However we are lucky that we can use the "csdfplot()" function from "Computational Statistics Toolbox" (Martinez & Martinez).
For example for univariate case:
pis = [0.3 0.6 0.4]; % mixing coefficients
mus = [-3 0 2] % means
vars= [1 1.5 0.5]; % variances
csdfplot(mus,vars,pis,-5,5);
For bivariate case, the variances become a covariance matrix, for example:
given p = (0.5,0.3,0.2), mu = ((-1,1),(1,1),(5,6)) and vars=((1 0;0 1),((0.5 0; 0 0.5),(1 0.5; 0.5 1))
pis = [0.3 0.6 0.4];
mus = [-3 0 2;-1 1 6];
vars = zeros(2,2,3);
vars(:,:,1)=[1 0; 0 1]; % eye(2)
vars(:,:,2)=[0.5 0; 0 0.5]; % eye(2)*0.5
vars(:,:,3)=[1 0.5; 0.5 1];
figure;
csdfplot(mus,vars,pis);
No comments:
Post a Comment