# how to fit 3d points with a non linear curve?

5 views (last 30 days)
luca antonioli on 20 Aug 2019
Answered: Alex Sha on 26 Aug 2019
hello, I have these points ( first colum is x cordinate, second is y cordinate and third is z cordinate).
my goal is to fit these points with a 3d curve: they are sclera surface points (sclera is a part of the eyeglobe that can be modelled as a ellipsoid) so i'm expecting an ellipse function in the space or just a part of it. I want to calculate the arclength of this part of the curve, so, I would have a mathematical equation to do the integral..
I've tried using the fitting toolbox but nothing ,I ve already searched on the forum but nothing...
can anyone help me?
points = [
-9.2836 -8.2360 -5.1328
-9.2261 -8.1850 -0.9157
-9.1251 -8.0953 -0.1483
-9.1246 -8.0949 -3.0498
-8.9797 -7.9664 -6.0975
-8.4251 -7.4743 -7.0451
-7.9054 -7.0133 -7.9331
-7.7326 -6.8600 -7.8448
-7.2632 -6.4436 -7.6050
-7.2632 -6.4436 -7.6050
-6.8659 -6.0911 -8.4124
-6.8434 -6.0711 -8.4581
-6.6529 -5.9021 -8.6478
-6.4493 -5.7215 -8.8505
-6.2142 -5.5130 -8.9064
-5.7780 -5.1260 -9.3982
-5.4242 -4.8121 -9.7969
-5.3082 -4.7092 -9.9064
-5.2255 -4.6358 -9.9665
-4.1891 -3.7164 -11.3792
-4.1542 -3.6854 -11.4154
-4.1364 -3.6696 -11.4286
-4.1162 -3.6517 -11.4354
-3.4141 -3.0289 -11.4215
-3.2885 -2.9174 -11.4190
-2.6937 -2.3897 -11.4072
-2.2985 -2.0391 -11.3994
-1.9732 -1.7505 -11.3929
-1.4682 -1.3025 -11.6907
-1.1315 -1.0038 -11.8893
-1.1254 -0.9984 -11.8887
-1.1177 -0.9916 -11.8879
-0.4374 -0.3880 -11.7442
0.0000 0.0000 -11.7540];

Alex Sha on 26 Aug 2019
How about the fit function fellow:
z = p1*exp(-0.5*(((x-p2)/p3)^2))+p4*exp(-0.5*(((y-p5)/p6)^2))+p7
Root of Mean Square Error (RMSE): 0.288723987265949
Sum of Squared Residual: 2.83429238797343
Correlation Coef. (R): 0.995496865084864
R-Square: 0.991014008393792
Determination Coef. (DC): 0.991014008393783
Chi-Square: -0.161670470284513
F-Statistic: 496.279531952741
Parameter Best Estimate
---------- -------------
p1 -16.1160680408573
p2 -1.49490026614748
p3 -7.84324518363849
p4 1.92526452647942E18
p5 -8.14010212547392
p6 0.00498580635142014
p7 4.26212632161697