which solver is best to solve a set of trig equation?
1 回表示 (過去 30 日間)
古いコメントを表示
I wonder if existing MATLAB solvers can solve my set of trignometric equations:

For the above equations, assume I know
,
,
, and
, and I want to solve for θ and ϕ.




I tried using fsolve with 2 and 3 equations but the solutions I got was incorrect:
%test
lambda = 0.06;
azi = 36;
ele = 55;
%DOA= [azi ele];
x1 = 0.06; y1 = 0 ; z1 = 0;
x2 = 0.12; y2 = 0; z2 = 0;
x3 = 0.06; y3 = 0.06; z3 = 0;
s1 = exp((2*pi*1j)*((x1*cosd(azi)*sind(ele)+y1*sind(azi)*sind(ele)+z1*cosd(ele))/lambda))
s2 = exp((2*pi*1j)*((x2*cosd(azi)*sind(ele)+y2*sind(azi)*sind(ele)+z2*cosd(ele))/lambda))
s3 = exp((2*pi*1j)*((x3*cosd(azi)*sind(ele)+y3*sind(azi)*sind(ele)+z3*cosd(ele))/lambda))
%now, work backward, use s1 and s2 ro find azi and ele, still try to use
%fsolve
leftside1 = real(log(s1)/(2*pi*1j)) %solution contains imaginary value == 0i
leftside2 = real(log(s2)/(2*pi*1j))
leftside3 = real(log(s3)/(2*pi*1j))
((x1*cosd(azi)*sind(ele)+y1*sind(azi)*sind(ele)+z1*cosd(ele))/lambda)-leftside1
((x2*cosd(azi)*sind(ele)+y2*sind(azi)*sind(ele)+z2*cosd(ele))/lambda)-leftside2
((x3*cosd(azi)*sind(ele)+y3*sind(azi)*sind(ele)+z3*cosd(ele))/lambda)-leftside3
options = optimoptions('fsolve','Display','none','PlotFcn',@optimplotfirstorderopt,'Algorithm','levenberg-marquardt')
fun = @(DOA)f_angle(DOA,leftside1,leftside2,leftside3);
DOA0 = [35,54];
DOA = fsolve(fun,DOA0,options)
function f = f_angle(DOA,leftside1,leftside2,leftside3)
lambda = 0.06;
x1 = 0.06; y1 = 0 ; z1 = 0;
x2 = 0.12; y2 = 0; z2 = 0;
x3 = 0.06; y3 = 0.06; z3 = 0;
f(1)= ((x1*cosd(DOA(1))*sind(DOA(2))+y1*sind(DOA(1))*sind(DOA(2))+z1*cosd(DOA(2)))/lambda) -leftside1;
f(2)= ((x2*cosd(DOA(1))*sind(DOA(2))+y2*sind(DOA(1))*sind(DOA(2))+z2*cosd(DOA(2)))/lambda) -leftside2;
f(3)= ((x3*cosd(DOA(1))*sind(DOA(2))+y3*sind(DOA(1))*sind(DOA(2))+z3*cosd(DOA(2)))/lambda) -leftside3;
end
my intended angle is [36 55] but fsolve returns [52.4154 5.9013].
Ultimately, my
value would contain some small noise so equal sign would turn into an approx equal sign so I think symbolic solver would be in no use.

Would be nice to know whether this set of equations are solvable using MATLAB? If so which solver/set up should I be looking into?
Thanks
2 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Nonlinear Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!