MATLAB Answers

Trouble while using fsolve function

2 ビュー (過去 30 日間)
Elsa Brailly
Elsa Brailly 2019 年 6 月 25 日
Commented: Torsten 2019 年 6 月 25 日
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 :
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,

  0 件のコメント

サインイン to comment.

件の回答 (1)

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
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