Professional Documents
Culture Documents
% HTML Conjugate Gradient %XI: Function
% HTML Conjugate Gradient %XI: Function
Xc=(1:C)';
Yc=(1:L)';
stepPH=C/(Nfa-1);
stepPV=L/(Nfa-1);
Mf_params_H=zeros(Nfa,4);
for i=1:Nfa % MFs centers in H direction
centers_H=stepPH*(i-1);
Mf_params_H(i,:)=[centers_H-stepPH centers_H
centers_H centers_H+stepPH];
end
Mf_params_V=zeros(Nfa,4);
for i=1:Nfa % MFs centers in V direction
centers_V=stepPV*(i-1);
Mf_params_V(i,:)=[centers_V-stepPV centers_V
centers_V centers_V+stepPV];
end
%%% evaluation des A et b
for j=1:size(Mf_params_H,1) % calcul
de Xi H (X):,Nbr
Mf_H(j,:)=trapmf(Xc,Mf_params_H(j,:));
end
for j=1:size(Mf_params_V,1) % calcul
de Xi V (V)
Mf_V(j,:)=trapmf(Yc,Mf_params_V(j,:));
end
A=0;
Xi=[];
for i=1:L
for j=1:C
Mf_VxH=Mf_V(:,i)*(Mf_H(:,j))';
Mf_VxH_col=Mf_VxH(:);
Xi_VxH_col=Mf_VxH_col/sum(Mf_VxH_col);
A=A+(Xi_VxH_col*Xi_VxH_col');
% Xi=[Xi Xi_VxH_col];
end
end
GAMA=inv(alpha*A+eye(size(A,1))/gama);