使用pso求最小化一函數(shù)
matlab程式碼,寫的非常簡(jiǎn)潔(不到100行),且還包括了2維的圖形展示,和大家分享參考!!!
一起學(xué)習(xí)matlab和各種optimize methods
最小化:(x-15)^2+(y-20)^2
The swarm matrix is
swarm(index, [location, velocity, best position, best value], [x, y components or the value component])
Author: Wesam ELSHAMY (wesamelshamy@yahoo.com) MSc Student, Electrical Enginering Dept., Faculty of Engineering Cairo University, Egypt
zemax源碼:
This DLL models a standard ZEMAX surface type, either plane, sphere, or conic
The surface also demonstrates a user-defined apodization filter
The filter is defined as part of the real ray trace, case 5
The filter can be used at the stop to produce x-y Gaussian apodization similar to the Gaussian pupil apodization in ZEMAX but separate in x and y.
The amplitude apodization is of the form EXP[-(Gx(x/R)^2 + Gy(y/R)^2)]
The transmission is of the form EXP[-2(Gx(x/R)^2 + Gy(y/R)^2)]
where
x^2 + y^2 = r^2
R = semi-diameter
The tranmitted intensity is maximum in the center.
T is set to 0 if semi-diameter < 1e-10 to avoid division by zero.