资源简介
Matlab实现EM算法,用于解决混合高斯模型, 包含用混合高斯模型生成测试数据的代码,包含二维图像生成代码,模式随机选取初值 和 用kmeans方法选取初值两种方式

代码片段和文件信息
function [Lcount] = demo()
marker = {‘*r‘‘+g‘‘.b‘‘xc‘‘om‘};
%% Generate Sample
mean = [4 5;10 15;15 10];
covariance(::1) = [9 0;0 9];
covariance(::2) = [6 0;0 6];
covariance(::3) = [4 0;0 4];
n = 1000; partion = [0.3 0.5 0.2];
k = 3;
X = Generate_Sample(mean covariance n partion);
%% Initialize the paramters
%[WMV] = Init_Kmeans(Xk);
%[WMV] = Init_Random();
[WMV] = Init_Random2();
% start timer
t_start = clock;
%% E-M Iteration
e = 0.000001; EPS = 1;
count = 1;
while EPS >= e
[El] = Exception(XkWMV);
[WMV] = Maximization(XkE);
L(count) = l;
if count == 1
EPS = abs(l);
else
EPS = abs(l - L(count-1));
end
count = count+1;
end
% calculate elapsed time
elapsed_time = etime(clock t_start);
fprintf(‘Iteration time is : %.4f s\nTteration count is : %d\n‘elapsed_timecount);
%% Draw the figure of clustering procedures
figure(2)
hold on
for i = 1:n
[a pos] = max(E(i:));
plot(X(i1)X(i2)char(marker(pos)));
end
title(‘E-M Clustering result‘);
xlabel(‘x1‘)ylabel(‘x2‘);
hold off
%% Draw the figure of the convergence
figure(3)
hold on
plot(1:count-1L‘--r*‘);
title(‘E-M Algorithm Convergence‘);
xlabel(‘number of EM steps‘)ylabel(‘The log-likelihood‘);
hold off
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 236278 2012-11-04 20:12 pic\k-means-convergence.bmp
文件 236278 2012-11-04 20:12 pic\k-means-result.bmp
文件 54 2012-11-04 20:12 pic\k-means-time.txt
文件 236278 2012-11-04 20:32 pic\kmeans-random1-random2.bmp
文件 236278 2012-11-04 20:20 pic\kmeans-random1.bmp
文件 236278 2012-11-04 20:13 pic\random1-convergence.bmp
文件 236278 2012-11-04 20:29 pic\random1-random2.bmp
文件 236278 2012-11-04 20:14 pic\random1-result.bmp
文件 56 2012-11-04 20:28 pic\random1.txt
文件 236278 2012-11-04 20:27 pic\random2-convergence.bmp
文件 236278 2012-11-04 20:28 pic\random2-result.bmp
文件 54 2012-11-04 20:14 pic\random2-time.txt
文件 236278 2012-11-04 16:51 pic\sample1.bmp
文件 1568 2012-11-04 20:26 demo.m
文件 363 2012-11-04 20:30 draw.m
文件 744 2012-11-03 11:00 Exception.m
文件 538 2012-11-04 16:50 Generate_Sample.m
文件 655 2012-11-04 17:35 Init_Kmeans.m
文件 257 2012-11-04 18:55 Init_Random.m
文件 174 2012-11-04 20:24 Init_Random2.m
文件 373 2012-11-03 10:14 Maximization.m
目录 0 2012-11-05 09:25 pic
----------- --------- ---------- ----- ----
2367616 22
- 上一篇:simuli
nk QAM - 下一篇:matlab2011中文汉化补丁
相关资源
- 串行级联cpm系统MATLAB仿真
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
评论
共有 条评论