I want to calculate the value of a & b for "x=110972.*a.*cos(b/2);" & " y=110972.*b.*cos(a/2);" equation where x=500 and y=700. But i can't, Please help me out. Thanks in advance.

1 次查看(过去 30 天)
clc
clear
x=500;
y=700;
x=110972.*a.*cos(b/2);
y=110972.*b.*cos(a/2);
a=
b=

采纳的回答

Star Strider
Star Strider 2014-6-14
This works:
x = 500;
y = 700;
% a = p(1), b = p(2)
fn = @(p) norm(x - 110972.*p(1).*cos(p(2)/2)) + norm(y - 110972.*p(2).*cos(p(1)/2));
[ab, fval] = fminsearch(fn, [1 1]);
fprintf(1,'\n\ta = %f\n\tb = %f\n\n',ab)
x2 = 110972.*ab(1).*cos(ab(2)/2)
y2 = 110972.*ab(2).*cos(ab(1)/2)
producing:
a = 0.004506
b = 0.006308
x2 =
500.0003e+000
y2 =
700.0000e+000

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by