new; feat=randn(10,3); m=mean(feat); v=var(feat); st=std(feat); cv=cov(feat); cc=corrcoef(feat); [xx,yy,zz]=ellipsoid(m(1),m(2),m(3),st(1),st(2),st(3),20); figure; set( gcf, 'name', 'Basic Statistics Demo'); plot3(feat(:,1),feat(:,2),feat(:,3),'o'); title( 'Samples, sample mean and STD ellipsoid'); axis equal; grid on; rotate3d on; hold on plot3(m(:,1),m(:,2),m(:,3),'xr','LineWidth',3,'MarkerSize',20); surf( xx, yy, zz); colormap gray; alpha(0.25); hold off; break fprintf( 'EXECURION PAUSED::Basic statistics demo::Type "return" to continue...\n'); keyboard; % construct a multivariate (bivariate) normal distribution of size 100x3 % mean is 0 for both variables, covariance matrix is 3x3 % and vectors are 100 feat = mvnrnd([0;0;0],[1 .9 .8;.9 1 .8;.8 .8 1],100); m=mean(feat) v=var(feat) st=std(feat) cv=cov(feat) cc=corrcoef(feat) [xx,yy,zz]=ellipsoid(m(1),m(2),m(3),cv(1,1),cv(1,2),cv(1,3),20); figure; set( gcf, 'name', 'Advanced Statistics Demo'); plot3(feat(:,1),feat(:,2),feat(:,3),'o'); title( 'Samples, sample mean and STD ellipsoid'); axis equal; grid on; rotate3d on; hold on plot3(m(:,1),m(:,2),m(:,3),'xr','LineWidth',3,'MarkerSize',20); surf( xx, yy, zz); colormap gray; alpha(0.25); hold off;