And another problem about population size and generation. I assigned this kind of value to these two variables.
f.option.PopulationSize = 500000; % Same to GA.
f.options.Generations = 1000 ;

I fixed that problem.
But one more stupid question about the objective function. Anyway, maybe I didn't understand it correctly, for I have been using GA. In GA, it always generate the maximum value of the objective function. But, here with the PSO, how I can obtain the maximum value or a minimum value. Do I need to specify some constraints with the parameters such as Aineq bineq something? Anyone help? Thanks.

Does the toolbox work for the problems that variables are more than 2?
For example, I want to implement something like
y = a1*x1 + a2*x2 + ... + an*xn
n >= 5
In my problem, I need to find out several coefficients by optimizing the 1st equation. It means that I have 'n' variables. To do so, I need to find out 'n' coefficients as well. But I got a problem of your toolbox. I have already sent you an email with my codes. Thanks.

I got a new problem when running it on FVC2004DB1.
The program failed to handler all the images of FVC2004DB1A. Actually, it does not work for most of the images of this database. But I have got another one that when I tried to assign block size as 32*32 to fft_enhance_cubs(img, BLKSZ). This function got a problem of matrix border.

??? Index exceeds matrix dimensions.

Error in ==> fft_enhance_cubs at 151
enhimg(nRow:nRow+BLKSZ-1,nCol:nCol+BLKSZ-1)=blk(OVRLP+1:OVRLP+BLKSZ,OVRLP+1:OVRLP+BLKSZ);

While reading your post I was reminded of a long and tedious hunt I recently did for an efficient algorithm to find the distance between two confocal ellipses. One of the things I came across was exactly this problem (point - ellipse), and I remembered I still had the code for it somewhere.
So, I brushed it a bit, and I've just posted it (I made an acknowledgement to you as well). I hope my code can help you out.

Comment only