MATLAB中关于nlinfit非线性拟合函数的应用

时间:2026-02-15 04:25:34

1、MATLAB中关于nlinfit非线性拟合函数的应用

2、clc,clear;

x1=xlsread('data.xls','B1:B15');

x2=xlsread('data.xls','C1:C15');

x=[x1,x2];

y = xlsread('data.xls','D1:D815');

%x = [x1,x2]; %自变量x1,x2

b=[1,2,3,4,5]; %初始参数值

fun=inline('b(1).*x(:,1).^b(2)+ b(3).*x(:,1).^b(4)+b(5)','b','x');

[b2,r,j]=nlinfit(x,y,fun,b);

b2 %最佳参数

R'=sum(r.^2) %误差平方和

3、x1=xlsread('data.xls','B1:B15');

x2=xlsread('data.xls','C1:C15');

为导入数据,需要结合自己的程序使用

© 2026 小道经验网
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com