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.

2 views (last 30 days)
clc
clear
x=500;
y=700;
x=110972.*a.*cos(b/2);
y=110972.*b.*cos(a/2);
a=
b=

Accepted Answer

Star Strider
Star Strider on 14 Jun 2014
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

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!