Question:
Problem while taking the inputs from the keyboard in MAT-LAB by using the fsolve function?
2006-09-26 06:40:58 UTC
The nonlinear equations i want to solve are
(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.
Three answers:
DoctaB01
2006-09-26 17:58:18 UTC
I looked at the matlab help file and I think you have been mislead. Matlab is known from time to time to give bad code and I think this is one of those times. In the example they imply that you can use an variable without giving it a value. This never works in matlab unless you use symbolic variables. I would recommend looking on the internet for some code that works.
Jenny
2006-09-26 06:44:32 UTC
if you call the 1-800 number they will be able to help you probably more than anyone on here can. i called yesterday and they solved all of my problems. my problems were on coarse compass, another of their affiliates. but the cheat code to talk to a real person for your issue is 2 2 2 1, i believe.
nwamah
2016-11-25 01:04:38 UTC
sure! My mouse went out ,and that i changed into left only with my pecker to variety on the keyboard! To on the present time, i trust i purchased an island and three better halves from Canada. (i have were given all you want)


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...