visualizationguassdata.m
来自「本贝叶斯分类器可以实现对二维高斯分布样本的分类」· M 代码 · 共 20 行
M
20 行
% To create a 1D Gaussian Distribution and show its histogram
model = struct('Mean',1,'Cov',2); % Gaussian parameters
figure(1); hold on;
% plot pdf of the Gaussisan Distribution
X_theo=[-4:0.2:5];
Y_theo=pdfgauss(X_theo,model);
Y_theo=Y_theo/sum(Y_theo);
plot(X_theo,Y_theo,'r');
[Y,X] = hist(gsamp(model,500),50); % compute histogram
bar(X,Y/500); % plot histogram
% To create a 2D Gaussian Distribution and show its histogram
model.Mean = [1;1]; % Mean vector
model.Cov = [1 0; 0 1]; % Covariance matrix
figure(2); hold on;
data=gsamp(model,250);
ppatterns(data); % plot sampled data
pgauss(model); % plot shape
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?