help-octave
[Top][All Lists]
Advanced

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

Re: Handle fsolve error


From: armando
Subject: Re: Handle fsolve error
Date: Tue, 10 Dec 2013 15:18:11 -0800 (PST)

Hi, Thanks for replying to my request.

I send a scrip that made what I want, BUT, but I intend to make the entry of  
'Xa', coordinate of point A [Xa,0,Za], with Za=Xa, and the distance betwin 
points A an Bm AB, via input, and then  I plan to the common point between the 
line z = m * x + b, m=1 which distance is  AB far from point A.

So, I must pass a vector x=[Xa, Za, AB] to the 


function y[Xb,Zb]=f(x)  or  function y[Xb,Zb]=f(Xa,Za,AB)

the equations are: 
(Zb-Za) / (Xb-Xa) * x + b - z = 0
(Xb-Xa)^2 + (Yb-Ya)^2 + (Zb-Za)^2 - AB^ 2= 0

endfunction


[y,info]=fsolve("f",[1;1]);

Xb=y(1);
Zb=y(2);

to obtain the poit B=[Xb,0,Zb]






would be very grateful if you could help.
Thank you




 
----------------------
armando herculano
----------------------
PORTUGAL
----------------------





Em Terça-feira, 10, Dezembro 2013 8:48:21, Andreas Weber-3 [via Octave] 
<address@hidden> escreveu:
 
Please keep the list in CC 

2013/12/9 lixo <[hidden email]>: 
> 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 
_______________________________________________ 
Help-octave mailing list 
[hidden email] 
https://mailman.cae.wisc.edu/listinfo/help-octave


________________________________
 
If you reply to this email, your message will be added to the discussion 
below:http://octave.1599824.n4.nabble.com/Handle-fsolve-error-tp4659907p4659976.html
 
To unsubscribe from Handle fsolve error, click here.
NAML

m4_uk.m (3K) <http://octave.1599824.n4.nabble.com/attachment/4660001/0/m4_uk.m>




--
View this message in context: 
http://octave.1599824.n4.nabble.com/Handle-fsolve-error-tp4659907p4660001.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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