Page 172 - Algorithm Collections for Digital Signal Processing Applications using MATLAB
P. 172
4. Selected Applications 161
s5=input('Enter the rank for image 5(Between 0 to 100)');
s6=input('Enter the rank for image 6(Between 0 to 100)');
s7=input('Enter the rank for image 7(Between 0 to 100)');
s8=input('Enter the rank for image 8(Between 0 to 100)');
vect=[s1 s2 s3 s4 s5 s6 s7 s8]/100;
normvect=vect/sum(vect);
c=cumsum(normvect);
u=[ ];
for i=1:1:4
r1=rand;
c2=c-r1;
[x,y]=find(c2>0);
if(y(1)==1)
u1=1
else
u1=y(1)-1
end
u=[u u1];
end
load NATUREFEATURE
for i=1:1:4
feature{i}=FEATURE(r(u(i)),:);
end
%Cross over to obtain 8 feature vectors
k=1;
for i=1:1:4
p1=round(rand*159)+1
r=round((rand*3)+1);
d1=feature{r};
r=round((rand*3)+1);
d2=feature{r}
nextfeature{k}=[d1(1:1:p1) d2(p1+1:1:160)];
k=k+1;
nextfeature{k}=[d1(1:1:p1) d2(p1+1:1:160)];
k=k+1;
end
r=[];
for l=1:1:8
n=nextfeature{l};
d=(FEATURE-repmat(n,94,1)).^2;
s=sum(d')