필터 지우기
필터 지우기

polynomial function 3D

조회 수: 65 (최근 30일)
Christoph Thorwartl
Christoph Thorwartl 2021년 1월 29일
댓글: Christoph Thorwartl 2021년 1월 29일
Hello,
I would like to put a second order polynomial function through 9 points. The points are given in the form P(x,y,z).
Goal:
(1) Calculate polynomial function
(2) Calculate the mean curvature (= second derivative) of the function
Is there something similar to "p = polyfit(x,y,z,n)"?
Remark:
I can put a circle through three points in space and calculate the corresponding curvature of the circle. For this I use "circlefit3d(p1,p2,p3)". But I don't want to use only 3 of the 9 points for the curvature calculation.
I would be very pleased about a feedback.
  댓글 수: 3
Christoph Thorwartl
Christoph Thorwartl 2021년 1월 29일
3D markers were fixed on the surface of an object (in a row). A force is applied to the object which causes it to bend. The bending line does not have a completely homogeneous curvature.
Christoph Thorwartl
Christoph Thorwartl 2021년 1월 29일
Picture see attached.

댓글을 달려면 로그인하십시오.

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2021년 1월 29일
You have the file exchange contribution polyfitn that should do what you want.
HTH

추가 답변 (1개)

Walter Roberson
Walter Roberson 2021년 1월 29일
Is there something similar to "p = polyfit(x,y,z,n)"?
No. However, polyfit() constructs the Vandermode companion matrix and then uses \ for linear least squared computation of the coefficients. You can do the same thing;
X = x(:); Y = Y(:); Z = Z(:);
A = [X.^2, X.*Y, Y.^2, X, Y, ones(size(X))];
b = Z;
A\b
Assuming a*x^2 + b*x*y + c*y^2 + d*x + e*y + f = z .
In particular, assuming that there is no z^2 or x*z or y*z .
If there are higher order z, then at the moment I am not sure how to set up the problem without ending up with a companion matrix and all zeros on the right hand side, which unfortunately leads you to an all-zero solution instead of something useful.
  댓글 수: 1
Christoph Thorwartl
Christoph Thorwartl 2021년 1월 29일
Thank you very much for your answer. I will now look at both approaches in detail.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by