Prev: Changing uitable data
Next: Euclidean distance
From: Matthew on 24 May 2010 20:23 Hey guys, I need to minimize this function: theta = acosd(sind(delta)*sind(phi)*cosd(beta)-sind(delta)*cosd(phi)*... sind(beta)*cosd(psi)+cosd(delta)*cosd(phi)*cosd(beta)*cosd(omega)+... cosd(delta)*sind(phi)*sind(beta)*cosd(psi)*cosd(omega)+cosd(delta)*... sind(beta)*sind(psi)*sind(omega)); to be more specific, theta(delta,phi,beta,psi,omega) delta, phi, and omega will be constant. I just want to find phi and beta that minimizes the function as close to zero as possible.
From: Matthew on 24 May 2010 20:30 ** Want to find beta and psi
From: Roger Stafford on 24 May 2010 23:00 "Matthew " <matthewnorlander(a)gmail.com> wrote in message <htf599$1h4$1(a)fred.mathworks.com>... > Hey guys, > > I need to minimize this function: > theta = acosd(sind(delta)*sind(phi)*cosd(beta)-sind(delta)*cosd(phi)*... > sind(beta)*cosd(psi)+cosd(delta)*cosd(phi)*cosd(beta)*cosd(omega)+... > cosd(delta)*sind(phi)*sind(beta)*cosd(psi)*cosd(omega)+cosd(delta)*... > sind(beta)*sind(psi)*sind(omega)); > > to be more specific, theta(delta,phi,beta,psi,omega) > > delta, phi, and omega will be constant. I just want to find phi and beta that minimizes the function as close to zero as possible. > ** Want to find beta and psi - - - - - - - - - - - - Do this: A = sind(delta)*sind(phi)+cosd(delta)*cosd(phi)*cosd(omega); B = -sind(delta)*cosd(phi)+cosd(delta)*sind(phi)*cosd(omega); C = cosd(delta)*sind(omega); omega = 180/pi*atan2(C,B); beta = 180/pi*atan2(sqrt(B^2+C^2),A); Then the argument of acosd will be 1 and thus theta will be 0. The reasoning is that you can easily show that A^2+B^2+C^2 = 1 is identically true. Then the argument of acosd can be written A*cosd(beta) + B*sind(beta)*cosd(psi) + C*sind(beta)*sind(psi) = A*cosd(beta) + (B*cosd(psi) + C*sind(psi))*sind(beta) By choosing psi = 180/pi*atan2(C,B) we make B*cosd(psi) + C*sind(psi) equal to sqrt(B^2+C^2). Thus the argument of acosd becomes A*cosd(beta) + sqrt(B^2+C^2)*sind(beta) Then by choosing beta = 180/pi*atan2(sqrt(B^2+C^2),A), we make the acosd argument equal to sqrt(A^2+B^2+C^2) which is just 1. Hence acosd(1) = 0 which is its minimum principal value. Roger Stafford
From: Roger Stafford on 24 May 2010 23:49 "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <htfefp$op0$1(a)fred.mathworks.com>... > ....... > A = sind(delta)*sind(phi)+cosd(delta)*cosd(phi)*cosd(omega); > B = -sind(delta)*cosd(phi)+cosd(delta)*sind(phi)*cosd(omega); > C = cosd(delta)*sind(omega); > omega = 180/pi*atan2(C,B); > beta = 180/pi*atan2(sqrt(B^2+C^2),A); > ....... - - - - - - - - - - I mistakenly changed omega instead of psi. The code should read: A = sind(delta)*sind(phi)+cosd(delta)*cosd(phi)*cosd(omega); B = -sind(delta)*cosd(phi)+cosd(delta)*sind(phi)*cosd(omega); C = cosd(delta)*sind(omega); psi = 180/pi*atan2(C,B); beta = 180/pi*atan2(sqrt(B^2+C^2),A); Roger Stafford
From: Walter Roberson on 24 May 2010 23:54
Roger Stafford wrote: > "Matthew " <matthewnorlander(a)gmail.com> wrote in message > <htf599$1h4$1(a)fred.mathworks.com>... >> I need to minimize this function: >> theta = acosd(sind(delta)*sind(phi)*cosd(beta)-sind(delta)*cosd(phi)*... >> sind(beta)*cosd(psi)+cosd(delta)*cosd(phi)*cosd(beta)*cosd(omega)+... >> cosd(delta)*sind(phi)*sind(beta)*cosd(psi)*cosd(omega)+cosd(delta)*... >> sind(beta)*sind(psi)*sind(omega)); > Do this: > Then the argument of acosd will be 1 and thus theta will be 0. There are also solutions for arbitrary phi. They are, however, more than 1000 lines long. |