2006-09-26 06:40:58 UTC
(xa1-x1)^2 + (ya1-y1)^2 - (p2)^2 =0
(xa1-x2)^2 + (ya1-y2)^2 - p1^2 =0
here xa1 & ya1 are the unknowns
i want to take the inputs from the keyboard of (x1,y1,x2,y2,p1,p2)
so i wrote the code like this in the mfile as
function F = myfun(x)
x1=input('enter the x1 for receiver 1: ');
y1=input('enter the y1 for receiver 1: ');
x2=input('enter the x2 for receiver 2: ');
y2=input('enter the y2 for receiver 2: ');
p1=input('enter the range from airborne pseudolite 1 to receiver 1: ');
p2=input('enter the range from airborne pseudolite 1 to receiver 2: ');
F = [(x(1)-x1)^2 + (x(2)-y1)^2 - p1a1^2 ;
(x(1)-x2)^2 + (x(2)-y2)^2 - p1a2^2] ;
and in the calling function
x0 = [-5; -5]; % Make a starting guess at the solution
options=optimset('Display','iter'); % Option to display output
[x,fval] = fsolve('myfun',x0,options) % call optimizer
so when i am giving fixed inputs for x1 &y1...getting output.