plotgauss.m
来自「Matlab源代码」· M 代码 · 共 25 行
M
25 行
function plotgauss(c,n,k)
% Function to simulate data from a Gaussian density in d dimensions
% and to plot the data in the first 2 dimensions
% input c: structure saving the mean and covarience
% n: size of data set
% k: the number of classes
color = ['g'; 'r'; 'b'; 'm';'c';'y'];
marker = ['o','x','*','+','s','d'];
figure;
for i = 1:k
data = mvnrnd(c(i).mu,c(i).covar,n);
scatter(data(:,1),data(:,2),color(i),'Marker',marker(i));
hold on
end
hold off
% axis([-6 6 -6 6]); % fix the lengths of the axes
xlabel('Dimension 1');
ylabel('Dimension 2');
title('Simulation of k classes Gaussian data in two dimensions');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?