资源简介
很多时候,我们需要的是一维、二维的高斯分布,但,有时需要球形分布的三维高斯分布。
代码片段和文件信息
function [elvelf] = ellipsedata3(covmatcenternumpointssigmarulevarargin)
%% Ellipsedata3 V1.000
%
% Constructs data points of ellipses representing contour curves of 3-dimensional
% Gaussian distributions with any covariance and mean value.
%
%% Example
%
% In this example the funcion ellipsedata constructs one ellipsoid (3-dimensional
% ellipse) of 400 points representing the contour curve corresponding to a standard
% deviation of 1.5 for a 3-dimensional Gaussian distribution with covariance matrix given by
% [411;121;111] and mean value given by [333].
%
% [elvelf]=ellipsedata3([411;121;111][333]201.5);
%
% The positions of the vertices are stored in elv and can be plotted as follows
%
% scatter3(elv(:1)elv(:2)elv(:3));
%
% The faces (vertices forming a patch) are stored in elf and can be plotted as follows
%
% patch(‘Faces‘elf‘Vertices‘elv‘FaceColor‘‘white‘‘EdgeColor‘‘black‘);
%
%% Input arguments
%
% covmat:
% Covariance matrix of a 3-dimensional Gaussian distribution. Must be of
% size 3x3 symmetric and positive definite. If the format is not
% correct an error is triggered. If the matrix is not symmetric it
% is symmetrized by adding its transpose and dividing by 2.
%
% center:
% The center (mean value) of the 3-dimensional Gaussian distribution. If
% the format is not correct it is set to [000].
%
% numpoints:
% Square root of the number of points that each ellipsoid will be composed of.
% Must be a positive integer number. If it is not numeric or positive it is
% set to 20. If it is not integer it is converted to integer using
% the function ceil.
%
% sigmarule:
% The proportion of standard deviation surrounded by each ellipsoid.
%
% varargin (later assigned to “zeroprecision“):
% A real number indicating the maximum difference after which two
% numbers are considered different. This value is used for assessing
% whether covmat is symmetric. If not specified it is set to 1E-12
%
%% Output arguments
%
% elv:
% Matrix in which each row represents the positions of the points (vertices)
% that constitute the ellipsoid.
%
% elf:
% Matrix with the indices of the vertices that constitute each face (patch)
% of the ellipsoid.
%
%% Version control
%
% V1.000: First version. Some points in elv are repeated. For simplicity
% they are left as such.
%
%
%% Please report any bugs to Hugo.Eyherabide@cs.helsinki.fi
%
% Copyright (c) 2014 Hugo Gabriel Eyherabide Department of Mathematics
% and Statistics Department of Computer Science and Helsinki Institute
% for Information Technology University of Helsinki Finland.
% All rights reserved.
%
% Redistribution and use in source and binary forms with or without
% modification are permitted provided that the following conditions
% are met:
%
% 1. Redistributions of source code must retain the above copyright
% notice this list of
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5835 2014-04-23 05:05 ellipsedata3.m
文件 2039 2014-04-23 01:12 license.txt
评论
共有 条评论