MATLAB Answers

0

Trouble while using fsolve function

Elsa Brailly さんによって質問されました 2019 年 6 月 25 日
最新アクティビティ Torsten
さんによって コメントされました 2019 年 6 月 25 日
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

  0 件のコメント

サインイン to comment.

タグ

1 件の回答

Torsten
回答者: Torsten
2019 年 6 月 25 日
編集済み: Torsten
2019 年 6 月 25 日

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 件のコメント

Elsa Brailly 2019 年 6 月 25 日
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
2019 年 6 月 25 日
(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.

サインイン to comment.



Translated by