简体   繁体   English

点云曲线拟合

[英]Cloud of points curve fitting

I have a 2D cloud of points, i imported them into matlab and i want to have a smoothing spline function that passes through them. 我有一个2D点云,我将它们导入到matlab中,并且我希望具有通过它们的平滑样条函数。 I tried with the "curve fitting" app and the "smoothing spline" option but in the extremes the function seems to not follow much the cloud and anyway in the middle of the cloud does not pass trough the points but goes up or down the points. 我尝试使用“曲线拟合”应用程序和“平滑样条曲线”选项,但是在极端情况下,该功能似乎并没有沿着云层移动,无论如何,在云层中间不会通过低点,而是会升高或降低点。 I tried "basic fitting" option after i plotted the cloud but no improvements as you can see: 在绘制云图之后,我尝试了“基本拟合”选项,但没有任何改善,如您所见: 在此处输入图片说明

The idea of what i wanted is this: 我想要的是这样的: 在此处输入图片说明

Of course i modified the image with Gimp (i am using linux) and the red line is a hand made one...so not so smooth as it would be. 当然,我用Gimp修改了图像(我正在使用linux),红线是手工制作的,所以不那么平滑。 Note i have magnified the image. 注意我放大了图像。 I was asking to myself if it was possible to have a variable grade fitting along all the cloud. 我在问自己,是否有可能在整个云中进行可变坡度拟合。 Anyway i don't know how to do it and any suggestion is appreciated. 无论如何,我不知道该怎么做,任何建议都值得赞赏。 在此处输入图片说明

The "smoothing spline" (in the "curve fitting tool") seems to be more equal to an interpolation than to a spline “平滑样条曲线”(在“曲线拟合工具”中)似乎更像是插值而不是样条曲线 在此处输入图片说明

You could use the function spline instead of the graphical tool. 您可以使用功能spline代替图形工具。 For example: 例如:

x = 1:100; % x-axis values for data
y = conv(randn(1,100),ones(1,10),'same'); % example smooth random data

xx = 1:.1:100; % x-axis values for plotting the spline
yy = spline(x,y,xx);
plot(x,y,'.',xx,yy)

结果图

See the doc of spline for more information. 有关更多信息,请参见spline文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM