Does curve fitting toolbox support 3D points?

Hi, I am beginning to use curve fitting toolbox. I read the document about the functions, however I find the functions are defined to fit 2D points. Currently I have to fit one curve for a 3D data set. I don't find any example code that fits 3D points. Many users need to fit 3D data set. Can anyone give me some advice or link to show how to use curve fitting toolbox for 3D points.
Regards Jogging

3 Commenti

Do you mean that you're fitting a function whose output takes values in R^3 or whose input? takes values in R^3? Do you have and could you use the Optimization Toolbox? LSQCURVEFIT can handle problems in arbitrary dimension.
Given input is 3D points, I hope to use one spline to represent the 3d points.
Matt J
Matt J il 12 Set 2014
Modificato: Matt J il 12 Set 2014
Then your input is not 3D. Your output space is 3D [x(t), y(t), z(t)] while your input is the 1D parameter, t. You are trying to fit a space curve in 3D.

Accedi per commentare.

Risposte (2)

Sean de Wolski
Sean de Wolski il 10 Set 2014
lsqcurvefit in the Optimization Toolbox or NonLinearModel.fit in the Statistics Toolbox.

3 Commenti

Liwei
Liwei il 12 Set 2014
Modificato: Liwei il 12 Set 2014
Thanks. Why does curve fitting toolbox have not such interface or example? It may help a lot if people try to use curve fitting for 3D points. Such question have been posted on the forum for several times.
Now I try to use the function from curve fitting toolbox and I will look into the the functions you mentioned later.
I have one question and hope to give some help.
It seems that curve fitting toolbox tries to fit a simple curve y(x),not a parametrized curve [x(t), y(t)]. Am I right?
t = cumsum([0;sqrt(diff(x(:)).^2 + diff(y(:)).^2 + diff(z(:)).^2)]);
sx = spline(t,x);
sy = spline(t,y);
sz = spline(t,z);
I don't understand that three components are functions of the distance between points.
Regards
Jogging
Matt J
Matt J il 12 Set 2014
Modificato: Matt J il 12 Set 2014
It may help a lot if people try to use curve fitting for 3D points.
Fitting a 3D spline [x(t), y(t), z(t)] is the same as doing 1D spline fits separately to x(t), y(t), and z(t). It doesn't require any new functionality. Also, as noted at the link you posted, there are already many tools for doing this kind of fitting freely available on the File Exchange, so there is less reason for MathWorks to try to sell their own.
I don't understand that three components are functions of the distance between points.
You want the curve [x(t),y(t),z(t)] to be traversed as t increases from 0 to something. The above is just one possible way of defining a range for the parameter t.
Thanks, Matt. Your clarification helps me understand spline curve.
I have several questions about the relation of knots and control points.
1. Is there any requirement about the number of knots and number of control points?
2. How are the knots obtained from control points? Is there any way to get the parameter t corresponding to one control points? From the link http://www.mathworks.com/help/curvefit/aptknt.html What does tau mean? Does it mean control points or knows points?

Accedi per commentare.

Marc
Marc il 14 Set 2014
Maybe I am not getting it but the current curve fitting tool allows for x, y and z data so there is 3D fitting support in the curve fitting toolbox.

2 Commenti

If the three components are fitting separately, do they need the same knot sequence? If so, why?
@Marc the current curve fitting toolbox allows either giving x,y (2D as input) or [x,y] and z meaning a surface. It does not allow to fit a 2d curve in 3d space. If there are any tools like that please let me know

Accedi per commentare.

Categorie

Richiesto:

il 10 Set 2014

Commentato:

il 20 Lug 2023

Community Treasure Hunt

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

Start Hunting!

Translated by