Hi!
I am using fmincon function to find the reflection point on a spherical reflector. I set a source point s at position (6,6,0), field point f at (-6,6,0) and the spherical reflector to get the reflection point r at (0,0,0). fmincon return the value of r that is very small, but not equal to zero. As I increase the radius of the reflector to infinitity, the inaccuracy becomes more obvious and will affect following calculations. I have try to use fminsearch, but still encounter the same problem.
I found out that it happened because fmincon and fminsearch do not return the answer of phi and theta as accurate as I need (pi/2). Is there any way to make the answer of fminsearch more accurate?
rad = 100; %set the radius of the spherical reflector
q = [0,-100,0]; %set the center of the spherical reflector
s = [6,6,0]; %set the signal source position
f = [-6,6,0]; %set the field point position
%calculate the minimum distance, fval between s and f, through point of reflection, r
L =@(w) sqrt((q(1) + rad.*sin(w(1)).*cos(w(2)) - s(1))^2 + (q(2) + rad.*sin(w(1)).*sin(w(2)) - s(2)).^2 + (q(3) + rad.*cos(w(1)) - s(3)).^2) + sqrt((f(1) - rad.*sin(w(1)).*cos(w(2)) - q(1)).^2 + (f(2) - rad.*sin(w(1)).*sin(w(2)) - q(2)).^2 + (f(3) - rad.*cos(w(1)) - q(1)).^2);w0= [0 0];[w,fval] = fmincon(L,w0,[],[],[],[],[0 0],[pi 2*pi]) %w1=theta, w2=phi
%determine point of reflection, r
x = q(1) + rad*sin(w(1))*cos(w(2));y = q(2) + rad*sin(w(1))*sin(w(2));z = q(3) + rad*cos(w(1));r = [x,y,z]
Best Answer