Matlab中通过数据点拟合指数曲线
有了可用的指数衰减数据,我想拟合一条穿过它的曲线。我怎样才能在Matlab中做到这一点?
Having data of an exponential decay available, I would like to fit a curve through it. How can I do that in Matlab?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
试试这个:
当
time
和data
是你的数据向量时;时间是自变量,数据是因变量。这将为您提供指数衰减曲线的系数。
Try this:
This is when
time
anddata
are your data vectors; time is the independent variable and data is the dependent variable.This will give you the coefficients of the exponential decay curve.
如果“拟合”指的是最小二乘法,则应该尝试 lsqcurvefit
If by fit you mean least squares, you should try lsqcurvefit
cftool(X,Y) 就是要走的路。
这是一些链接:
LINK1
LINK2
cftool(X,Y) is the way to go.
here's some linkage:
LINK1
LINK2
线性化、最小二乘、非线性化:-)
Linearise, least squares, delinearise :-)
Matlab有一个函数叫做polyfit。它可以将曲线拟合到可以以 a*X^n+b*X^(n-1)+.....z 形式表示的数据。但是,如果您确定数据存在某种指数衰减,您可以尝试先对数据取对数,然后使用 polyfit 函数。我认为这会起作用。
Matlab has a function called polyfit. It can fit curve to a data which can be represented in the form a*X^n+b*X^(n-1)+.....z. However if you are sure that the data is of some exponential decay you can try taking logarithm of the data first and then using the polyfit function. I thing that will work.