Azzera filtri
Azzera filtri

How to fit a polynomial surface to point cloud using any optimization method?

31 visualizzazioni (ultimi 30 giorni)
suppose the data points are given (point cloud:Q_r) , and i want to fit a polynomial surface to the given data points. Suppose the surface Bezier surface
where , if m,n=3, then the bicubic surface in term of polynomial function become
The goal is to obtain the free-form polynomial Bezier surface (bicubic for my case) that fits the data points better in the discrete least-squares sense. To do so, we have to compute the control points P_{𝑖,𝑗},𝑖=0,...,𝑚;𝑗=0,...,𝑛 of the approximating surface by minimizing the least-squares error, 𝐸, defined as the sum of squares of the residuals:
.
Is there any way we can apply MATLAB optimization technique, so that i will get the best coefficient (P_{i,j}) that fit the original data?
To find best (P_{i,j}) i need to find best u and v parameter vector that will give me best (P_{i,j}) using least square.
Any suggestions, recomendation, link to c.f is appreciated.

Risposta accettata

Saarthak Gupta
Saarthak Gupta il 5 Set 2023
Modificato: Saarthak Gupta il 6 Set 2023
Hi moaad,
As per my understanding, you are trying to fit a Bezier polynomial to a given set of points (Q_r). MATLAB offers the ‘fit’ function as part of the Curve Fitting Toolbox, which can help you achieve the desired result.
Refer to the following steps:
  • Define the Bezier polynomial as an anonymous function. It is important that in the input order of the anonymous function, the coefficients (p00,…,p33) must precede the independent variables (x, y).
Bezier_bicubic = @(p00,p01,p02,p03,p10 p33,x,y) (1-x)^3*(1-y)^3*p00 x^3*y^3*p33;
  • Use the anonymous function as an input to the ‘fit’ function.
[f1, gof_params] = fit([Xr, Yr], Qr, Bezier_bicubic);
fit returns an ‘sfit’ object (f1) and a ‘gof’ structure (gof_params). ‘gof_params’ contains the goodness-of-fit statistics, and can further be used to evaluate how well the model fit the data.
The same results can also be reproduced interactively. Please refer to the following example for more information: https://in.mathworks.com/help/curvefit/custom-nonlinear-surface-fitting-examples.html
Please refer to the following MATLAB documentation for more details:

Più risposte (0)

Categorie

Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by