matlab中怎样用幂函数拟合方程

2024-10-28 04:39:42
推荐回答(4个)
回答(1):

直接使用CFTOOL工具箱
命令行输入cftool即可,然后选择拟合类型
x=[6.69:0.02:7.53];
y=[4.2,3.7,3.3,2.95,2.63,2.33,2.11,1.87,1.65,1.47,1.32,1.17,1.04,0.925,0.82,0.735,0.653,0.582,0.52,0.462,0.412,0.366,0.325,0.289,0.258,0.23,0.205,0.182,0.162,0.145,0.129,0.115,0.102,0.091,0.081,0.072,0.064,0.057,0.051,0.0455,0.0403,0.036,0.032];
直接输入cftool进入曲线拟合工具箱界面“Curve Fitting tool”
(1)点击“Data”按钮,弹出“Data”窗口;
(2)利用X data和Y data的下拉菜单读入数据x,y,然后点击“Create data set”按钮,退出“Data”窗口,返回工具箱界面,这时会自动画出数据集的曲线图;
(3)点击“Fitting”按钮,弹出“Fitting”窗口;
(4)点击“New fit”按钮,可修改拟合项目名称“Fit name”,通过“Data set”下拉菜单选择数据集,然后通过下拉菜单“Type of fit”选择拟合曲线的类型,选择类型Power:幂逼近,有2种类型,a*x^b 、a*x^b + c

回答(2):

是拟合三条还是一条?

 

感觉纯拟合的话用origin比较好

 

拟合了第一条,确实是幂函数

线性相关度达到5个9,基本上完全符合

回答(3):

以第一个为例:
1、在命令行输入数据:
x=6.69:0.02:7.53;
y=4.2,3.7,3.3,2.95,2.63,2.33,2.11,1.87,1.65,1.47,1.32,1.17,1.04,0.925,0.82,0.735,0.653,0.582,0.52,0.462,0.412,0.366,0.325,0.289,0.258,0.23,0.205,0.182,0.162,0.145,0.129,0.115,0.102,0.091,0.081,0.072,0.064,0.057,0.051,0.0455,0.0403,0.036,0.032];
2、启动曲线拟合工具箱
>>cftool
3、进入曲线拟合工具箱界面“Curve Fitting tool”
(1)点击“Data”按钮,弹出“Data”窗口;
(2)利用X data和Y data的下拉菜单读入数据x,y,可修改数据集名“Data set name”,然后点击“Create data set”按钮,退出“Data”窗口,返回工具箱界面,这时会自动画出数据集的曲线图;
(3)点击“Fitting”按钮,弹出“Fitting”窗口;
(4)点击“New fit”按钮,可修改拟合项目名称“Fit name”,通过“Data set”下拉菜单选择数据集,然后通过下拉菜单“Type of fit”选择拟合曲线的类型,工具箱提供的拟合类型有:
Custom Equations:用户自定义的函数类型Power:幂逼近,有2种类型,a*x^b 、a*x^b + c在本例中选Power,即可得到拟合曲线。

回答(4):

回归模型需要你去查询相关书籍,好像是数据处理之类的书籍吧。
首先建立一个简单的m文件,然后你可以将每组的抽取一个数组,计算出相应的a,b,c,这样你可以求得(7.53-6.69)/0.02个a,b,c的值,然后将其求一下平均值。或者通过其余一些方法进行稍微拟合一下。