📄 plotgauss.m
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -