資源簡介
本算是基于matlab實現了一種基于角點匹配的檢測算法。

代碼片段和文件信息
function?[OUTvarargout]=PSO(structure)
D=3;
rand(‘state‘sum(100*clock));
if?nargin?1
???error(‘Not?enough?arguments.‘);
end
????
%?PSO?PARAMETERS
???VRmin=ones(D1)*-20;?
???VRmax=ones(D1)*20;????
???VR=[VRminVRmax];
???minmax?=?1;
P?=[1?2000?20?4?2?2?0.9?0.2?1500?2?1e-5?20?1];
df??=?P(1);
me??=?P(2);
ps??=?P(3);
mv??=?P(4);
ac1?=?P(5);
ac2?=?P(6);
iw1?=?P(7);
iw2?=?P(8);
iwe?=?P(9);
flagg=P(10);
ergrd=P(11);
ergrdep=P(12);
plotflg=P(13);
%?PLOTTING
?message?=?sprintf(‘PSO:?%%g/%g?iterations?GBest?=?%%g.\n‘me);
pos=40*rand(psD)-20;
vel=8*rand(psD)-4;
?
%?initial?pbest?positions?vals
?pbest=pos;
?
?for?j=1:ps??%?start?particle?loop
????numin=‘0‘;
????for?i=1:D
????????numin=strcat(numin‘‘num2str(pos(ji)));
????end
%?????evstrg=strcat(‘feval(‘‘‘functname‘‘‘‘numin(2:end)‘structure‘‘)‘);??
evstrg=strcat(‘feval(‘‘myMI‘‘‘numin(2:end)‘structure‘‘)‘);
????out(j)=eval(evstrg);?????%?evaluate?desired?function?with?particle?j??????
?end
?
?pbestval=out;???%?initially?pbest?is?same?as?pos
%?assign?initial?gbest?here?also?(gbest?and?gbestval)
?if?minmax==1
????[gbestvalidx1]=max(pbestval);??%?this?picks?gbestval?when?we?want?to?maximize?the?function
?elseif?minmax==0
????[gbestvalidx1]=min(pbestval);??%?this?works?for?straight?minimization
?end
?gbest=pbest(idx1:);??%?this?is?gbest?position
?tr(1)=gbestval;???????%?save?for?output
%?start?PSO?iterative?procedures
cnt=0;?%?counter?used?for?updating?display?according?to?df?in?the?options
cnt2=0;?%?counter?used?for?the?stopping?subroutine?based?on?error?convergence
for?i=1:me??%?start?epoch?loop?(iterations)
???if?flagg==0???%?randimization?control?one?random?set?for?each?epoch
???????rannum1=rand(1);??
???????rannum2=rand(2);
???end
???
???for?j=1:ps??%?start?particle?loop
???????
?????if?flagg==1???%?randomization?control?one?random?set?for?each?particle?at?each?epoch
?????????rannum1=rand(1);
?????????rannum2=rand(1);
?????end
?????numin=‘0‘;
?????for?dimcnt=1:D
?????????numin=strcat(numin‘‘num2str(pos(jdimcnt)));
?????end
%??????evstrg=strcat(‘feval(‘‘‘functname‘‘‘‘numin(2:end)‘structure‘‘)‘);?
evstrg=strcat(‘feval(‘‘myMI‘‘‘numin(2:end)‘structure‘‘)‘);
?????out(j)=eval(evstrg);?????%?evaluate?desired?function?with?particle?j??
?????e(j)?=?out(j);??????????????%?use?to?minimize?or?maximize?function?to?unknown?values
?????%SSEhist(j)?=?sumsqr(e);????%?sum?squared?‘error‘?for?jth?particle?(averages?if?there?is?more?than?one?output)
?????
????%?update?pbest?to?reflect?whether?searching?for?max?or?min?of?function
?????if?minmax==0
???????if?pbestval(j)>=e(j);
??????????pbestval(j)=e(j);
??????????pbest(j:)=pos(j:);
???????end
?????elseif?minmax==1
???????if?pbestval(j)<=e(j);
???????????pbestval(j)=e(j);
???????????pbest(j:)=pos(j:);
???????end
?????end
?
??????????
????%?assign?gbest?by?finding?minimum?of?all?particle?pbests?
?????if?minmax==1
???????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????5902??2005-10-19?20:10??SUSAN_CORNER_MATCH.m
?-rw-r--r--???????227??2011-08-12?15:27??readme_verysource.com.txt
-----------?---------??----------?-----??----
?????????????????6129????????????????????2
- 上一篇:elcentro.mat
- 下一篇:LDPC碼MATLAB程序
評論
共有 條評論