% EM algorithm for k multidimensional Gaussian mixture estimation
%
% Inputs:
% X(n,d) - input data, n=number of observations, d=dimension of variable
% k - maximum number of Gaussian components allowed
% ltol - percentage of the log likelihood difference between 2 iterations ([] for none)
% maxiter - maximum number of iteration allowed ([] for none)
% pflag - 1 for plotting GM for 1D or 2D cases only, 0 otherwise ([] for none)
% Init - structure of initial W, M, V: Init.W, Init.M, Init.V ([] for none)
%
% Ouputs:
% W(1,k) - estimated weights of GM
% M(d,k) - estimated mean vectors of GM
% V(d,d,k) - estimated covariance matrices of GM
% L - log likelihood of estimates
%
K9F1208U0M 的ALE、CLE分別由DSP 的A1 和A0 控制。DSP的低8位數據線直接與閃存的I/O0-I/O7 相連,實現命令、地址和數據的傳輸; DSP的通用I/O口IOA2 接R/B,監測存儲器的工作狀態,當R/ B 處于低電平時,表示有編程、擦除或隨機讀操作正在進行;操作完成后, R/ B 會自動返回高電平。DSP的W E 、R D 分別接FLASH的W E 、R E , 控制讀、寫操作。CS2接閃存的片選線CE。
function [U,center,result,w,obj_fcn]= fenlei(data)
[data_n,in_n] = size(data)
m= 2 % Exponent for U
max_iter = 100 % Max. iteration
min_impro =1e-5 % Min. improvement
c=3
[center, U, obj_fcn] = fcm(data, c)
for i=1:max_iter
if F(U)>0.98
break
else
w_new=eye(in_n,in_n)
center1=sum(center)/c
a=center1(1)./center1
deta=center-center1(ones(c,1),:)
w=sqrt(sum(deta.^2)).*a
for j=1:in_n
w_new(j,j)=w(j)
end
data1=data*w_new
[center, U, obj_fcn] = fcm(data1, c)
center=center./w(ones(c,1),:)
obj_fcn=obj_fcn/sum(w.^2)
end
end
display(i)
result=zeros(1,data_n) U_=max(U)
for i=1:data_n
for j=1:c
if U(j,i)==U_(i)
result(i)=j continue
end
end
end
一個基于GTK+的單詞數值計算器,1、 按照規則計算單詞的值,如果 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 26個字母(全部用大寫)的值分別為 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26,如:
WINJACK這個單詞的值就為:W+I+N+J+A+C+K=23+9+14+1+3+11=71%
HARDWORK=H+A+R+D+W+O+R+D=8+1+18+4+23+15+18+11=98%
LOVE=L+O+V+E=12+15+22+5=54%
LUCK=L+U+C+K=12+21+3+11=47%
ATTITUDE= A+T+T+I+T+U+D+E=1+20+20+9+20+24+4+5=100%
2、對程序的界面布局參考如下圖所示,在第一個單行文本框輸入一個單詞,點擊“計算”按鈕,按照以上算法計算出該單詞的值。
3、如果在最下面的單行文本框輸入一個文件路徑,此文件每行記錄一個單詞,那么經過程序計算出各個單詞的值,并把結果輸出到當前目錄下result.txt文件中。如果文件不存在,應該提示錯誤。