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=
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!