如何在MATLAB中将曲线拟合到阻尼正弦波 [英] How to fit a curve to a damped sine wave in matlab

查看:705
本文介绍了如何在MATLAB中将曲线拟合到阻尼正弦波的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做过一些测量,应该是阻尼正弦波,但是我找不到任何有关如何使用Matlab曲线拟合工具制作(如果可能)好的阻尼正弦波的信息.

I have some measurements done and It should be a damped sine wave but I can't find any information on how to make (if possible) a good damped sine wave with Matlab's curve fitting tool.

这是我使用平滑样条线"得到的结果:

Here's what I get using a "Smoothing spline":

图片http://s21.postimg.org/yznumla1h/damped.png.

编辑1 : 这是我使用自定义方程式"选项得到的结果:

Edit 1: Here's what I got using the "custom equation" option:

编辑2 : 我已将数据以csv格式上传到 pastebin ,其中第一列是幅度,第二列是时间

Edit 2: I've uploaded the data to pastebin in csv format where the first column is the amplitude and the second is the time.

推荐答案

可以使用以下代码创建阻尼sin函数:

The damped sin function can be created using the following code:

f=f*2*pi;
t=0:.001:1;
y=A*sin(f*t + phi).*exp(-a*t);

plot(t,y);
axis([0 1 -2.2 2.2]);

现在,您可以使用Matlab中的"cftool"并加载数据,然后将方程式类型设置为custom,然后输入阻尼sin函数的公式.在这里,您可以看到我到目前为止所发现的...

Now you can use "cftool" from matlab and load your data then set the equation type to custom and enter the formula of the damped sin function. Here you can see what I found so far...

我认为数据的分布使拟合工具难以很好地拟合.它可能需要更多数据或更多分布式数据.此外,还有其他工具和方法,例如,请立即检查:docstoc.com/docs/74524947/Mathcad-Damped-sine-fit-mcd

I think the distribution of the data makes it hard for the fitting tool to do a good fit. It may need more data or more distributed data. In addition, there are other tools and methods as well, for instance check this for now: docstoc.com/docs/74524947/Mathcad-Damped-sine-fit-mcd

对于所有实际上试图搜索和找到局部最优值(针对每个拟合参数)的方法,最重要的是初始条件.我相信,如果您选择一个好的初始条件(初步猜测),则拟合工具会很好用.

For all these methods that actually trying to search and find a local optimum (for each fitting parameters), the most important thing is the initial condition. I believe if you choose a good initial condition (initial guess), the fitting tool works well.

祝你好运

这篇关于如何在MATLAB中将曲线拟合到阻尼正弦波的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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