C ++曲线拟合程序,polyfit [英] C++ curve fitting program, polyfit

查看:712
本文介绍了C ++曲线拟合程序,polyfit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我一直试图曲线拟合平滑且稍微摆动的曲线。我已经尝试使用内置函数' polyfit '在MATLAB中对此曲线进行建模,并使用' polyval 。使用MATLAB建模和绘图是成功的:)。



我的最终目标是用C ++编写这个程序,我可以用最小二乘法建模和检索多项式系数适合。我写这个程序的部分成功,然而,与MATLAB结果相比的结果是不正确的。我假设我从MATLAB得到的结果是正确的,这对我的情况来说是一个相当不错的假设。



作为参考,我使用过这个已编写过的示例程序 http://www.nr.com/forum/showthread.php?t=1452 [ ^ ]。该程序使用Numerical Recipes中的标题进行评估。



我想知道是否有更好的方法来解决最小二乘拟合问题。 :confused:



感谢您的时间,希望尽快得到一些建议!



BM

Hello,

I have been trying to curve fit a smooth and slightly oscillating curve. I have already tried to model this curve in MATLAB using the built in function 'polyfit' and to graph it using 'polyval'. Modeling and graphing using MATLAB was successful :) .

The ultimate goal of mine is to write this program in C++ in which I can model and retrieve polynomial coefficients using least squares fit. I was partially successful writing this program, however, the results compared to MATLAB result were not correct. I assume that the results I get from MATLAB is correct and this is a fairly good assumption for my case.

As a reference, I have used this sample program someone already has written, http://www.nr.com/forum/showthread.php?t=1452[^]. This program is evaluated using the headers from 'Numerical Recipes'.

I was wondering if there is any better way to approach the least squares fit problem. :confused:

Thank you for your time and hope to get some advise soon!

BM

推荐答案

你的意思是什么,完全符合

What does you mean, exactly with
Jungyeoul Maeng写道:
Jungyeoul Maeng wrote:

我写这个程序部分成功,但是,与MATLAB结果相比的结果不正确

I was partially successful writing this program, however, the results compared to MATLAB result were not correct







什么是不合格的?

:)


?

What is unsatisfactory in your fit?
:)


参见http://www.slscope.co.uk/software/polyfit/index.html [ ^ ]


这篇关于C ++曲线拟合程序,polyfit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆