help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handle fsolve error


From: Andreas Weber
Subject: Re: Handle fsolve error
Date: Tue, 10 Dec 2013 09:46:15 +0100

Please keep the list in CC

2013/12/9 lixo <address@hidden>:
> Xa=input('----------cood. x do ponto A: ')
> AB=input('----------AB diametro maior da ELIPSE: ')

I guess that are to scalars? Please use english on the mailing list.

> Za=Xa;
> A=[Xa 0 Za]
A is unused?

> xx=[Xa Za AB]

so xx is now [Xa Xa AB]

> function y(x)=XbZb(xx)
as I wrote previously, this is not a valif function declaration. See
https://www.gnu.org/software/octave/doc/interpreter/Defining-Functions.html#Defining-Functions
for examples

> y(1)= (x(1)-xx(2))/(x(2)-xx(1))*xx(1)+0-x(2);
> y(2)=(x(1)-xx(1))^2+(x(2)-xx(2))^2-xx(3)^2;

There is no "x" defined here. Also I doubt +0 does make any sense

> [x,info]=fsolve("XbZb",[1;1])
Here you give a vector with 2 elements as initial starting guess but
you are trying to access xx(3) above. That won't work.


> Then I  change to:
>
> function y=XbZb(xx)
> Octave Terminal answer:
>
>>>>error: `x' undefined near line 12 column 8

As I already wrote above, "x" is unknown inside that function. What
value do you expect?

Perhaps you can create a example with fixed values (not "input" call)
and your expected output.
Andy


reply via email to

[Prev in Thread] Current Thread [Next in Thread]