From: Fotis Stathopoulos on
hi all,

i want to give as input the parameters of the equations that i solve in fsolve.

when i try for a "small" problem/equation
(eg circle: F(:) = (x-par(1,:))^2 + (y-par(2,:))^2 - 1)
to find one intersection of 2 or 3 circles, by giving a (2,2) or (2,3) matrix for -par-
it works, giving me one position (x,y):
outp = fsolve(@F, in_xy, [], par, options);

My current problem (F) has 8 equations, with 5 variables and 4 known parameters.
Normally by giving a (4,8) matrix for -par- (or 4 arrays: par1, par2..) to fsolve it would work like before..but it doesn't..

i get the following message:
___
??? Error using ==> SPS_solution
Too many input arguments.

Error in ==> fsolve at 253
fuser = feval(funfcn{3},x,varargin{:});

Error in ==> F_out at 156
outp = fsolve(@F, in_v, [], a, options);

Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE
cannot continue.
___

i have tried a lot of things (decrease the number of the parameters , transpose, etz..) but nothing of them worked..do you have any idea where is the error??

thank you in advance,
Fotis
From: John D'Errico on
"Fotis Stathopoulos" <fotis.stathopoulos(a)gmail.com> wrote in message <hlh4h5$10k$1(a)fred.mathworks.com>...
> hi all,
>
> i want to give as input the parameters of the equations that i solve in fsolve.
>
> when i try for a "small" problem/equation
> (eg circle: F(:) = (x-par(1,:))^2 + (y-par(2,:))^2 - 1)
> to find one intersection of 2 or 3 circles, by giving a (2,2) or (2,3) matrix for -par-
> it works, giving me one position (x,y):
> outp = fsolve(@F, in_xy, [], par, options);

(snip)

> i have tried a lot of things (decrease the number of the parameters , transpose, etz..) but nothing of them worked..do you have any idea where is the error??
>

Trying random things like a transpose is unlikely
to get you far. READ THE HELP.

Why are you passing in 5 arguments to fsolve?
What do you expect fsolve to do with them?
How should fsolve be able to guess what to do
with the third argument [] that you passed in?
And how should fsolve guess that par is apparently
an argument to pass into your objective function?

fsolve takes three arguments.

If you wish to pass in par to F, then call fsolve
like this:

outp = fsolve(@(xy) F(xy,par), in_xy, options);

I have no idea what you wanted to do with the
empty array [] in your original call. Was it
intended as an argument to F? If so, then you
would do this:

outp = fsolve(@(xy) F(xy,[],par), in_xy, options);

John