matlab线性拟合和非线性拟合,matlab多元非线性拟合

希望虫友能给与帮助

采用多元非线性回归:

data.txt

168.7        202.9        145.9        12.1

142.0        206.4        152.9        15.8

181.9        205.8        144.2        10.7

119.7        206.8        156.2        20.9

243.9        203.9        130.6        5.0

170.1        205.8        141.9        17.2

167.3        200.1        138.7        16.3

269.2        203.2        132.0        9.7

254.1        205.4        128.9        10.6

325.2        208.8        123.4        6.7

83.9        210.0        153.4        17.1

26.7        206.4        176.6        92.9

-1.3        207.1        190.8        149.8

79.3        209.2        157.2        21.4

68.2        210.6        167.9        44.7

41.1        205.2        162.9        61.3

8.4        198.8        176.1        115.7

50.1        209.8        167.3        64.9

189.7        216.8        160.2        20.9

50.7        200.4        158.2        46.4

35.9        207.1        167.9        64.0

function main

clc

clear

data=load('data.txt');

y=data(:,1);

x=data(:,2:4);

beta=;            % 回归系数的初值,任意取

yy=fun(beta,x);

=nlinfit(x,y,@fun,beta);

beta_out

mse

betaci=nlparci(beta_out,r,'Jacobian',J);

betaa=

=nlpredci(@fun,x,beta_out,r,'Jacobian',J);

alpha=0.05;

nlintool(x,y,'fun',beta,alpha)

r=corrcoef(y,yy)       % 求相关系数r

plotregression(y,yy)   % 并且画图r

regstats(y,yy)

function yy=fun(beta,x)

b1 = beta(1);

b2 = beta(2);

b3 = beta(3);

b4 = beta(4);

yy=b1*(x(:,1).^b2).*(x(:,2).^b3).*(x(:,3).^b4);

运行时显示??? Error: File: D:\新建文件夹\main.m Line: 9 Column: 1

The expression to the left of the equals sign is not a valid target for an assignment.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值