Trouble while using fsolve function

1 visualizzazione (ultimi 30 giorni)
Elsa Brailly
Elsa Brailly il 25 Giu 2019
Commentato: Torsten il 25 Giu 2019
Hello,
I want to find a tangent plane to an ellispoid at a choosen point of the ellispoid.
To do this, I use the fsolve function to solve the folowing equation :
F(p)=-=0
with (u,v,w), known, the semi-axis lenght of the ellispoid.
(x,y,z),known, the coordinates of the choosen point, belonging to the ellipdoid.
with (p,q,r), the normal vector to the tangent plane. p is the variable we are looking for and q and r are fixed.
The problem is that fsolve doesn't give me a zero solution.
I think that the problem comes from my option set (options = optimset('Display', 'iter','TolFun',10e-50)) But I don't master this part of setting options...
The error message I get is the following one :
No solution found. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance squared, but the vector of function values is not near zero as measured by the value of the function tolerance.
<stopping criteria details> fsolve stopped because the relative norm of the current step, 4.528682e-13, is less than max(options.StepTolerance^2,eps) = 1.000000e-12. However, the sum of squared function values, r = 6.213593e+01, exceeds sqrt(options.FunctionTolerance) = 3.162278e-25.
Attached, my code,
Thank you for your help,
Elsa

Risposte (1)

Torsten
Torsten il 25 Giu 2019
Modificato: Torsten il 25 Giu 2019
If you have an ellipsoid given as f(x,y,z)=0 and a point P0 on the ellipsoid P0 = (x0,y0,z0), why don't you just use
(df/dx(P0),df/dy(P0),df/dz(P0))*(x,y,z)' - (df/dx(P0),df/dy(P0),df/dz(P0))*(x0,y0,z0)' = 0
as the tangent plane in P0?
  2 Commenti
Elsa Brailly
Elsa Brailly il 25 Giu 2019
Modificato: Elsa Brailly il 25 Giu 2019
Thank you for your answer,
I don't masterise derivatives on matlab...
The problem is that I don't know how to get (x0,y0,z0)'
PS: I don't have the symbolic math toolbox
Thank you
Torsten
Torsten il 25 Giu 2019
(p*x + q*y+r*z)^2 = u^2*p^2+v^2*q^2+w^2*r^2
-> p^2*(x^2-u^2) + 2*p*x*(q*y+r*z) + (q*y+r*z)^2 -v^2*q^2-w^2*r^2 = 0
-> p^2 + 2*p * x*(q*y+r*z)/(x^2-u^2) + ((q*y+r*z)^2 -v^2*q^2-w^2*r^2)/(x^2-u^2) = 0
Quadratic equation in p. Use the binomial formula to solve for p.

Accedi per commentare.

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by