怎么用matlab回归非线性数据
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/08/31 14:18:05
怎么用matlab回归非线性数据
请具体一点
请具体一点
给你一个例子看看.
clc;clear
dat=[
0.8853 87.7513
0.9943 78.0249
1.3615 75.3307
2.8419 74.9392
5.7365 74.4935
9.5169 73.4786
13.467 71.6243
16.9629 68.6216
19.5727 64.4005
21.1302 59.2471
21.708 53.649
21.5302 48.0889
20.8489 42.8944
19.8802 38.2365
18.7755 34.1572
17.6438 30.6373
16.5316 27.6132
15.4804 25.0207
14.505 22.7949
13.6031 20.8748
12.7786 19.2113
12.0275 17.7627
11.3434 16.4944
10.7188 15.3775
10.1497 14.3886
9.6304 13.5086
9.1559 12.7217
8.7206 12.0156
8.3209 11.3783
7.9534 10.8008];
X=dat(:,1);
Y=dat(:,2);
sp=csaps(Y,X);
R=CORRCOEF(sp.breaks,Y)
plot(Y,X,'o');hold on; fnplt(sp,'r');hold off
xlabel('Y'),ylabel('X')
最好能把你的问题列出来,有针对性.
还可以用非线性回归函数:
nlinfit
nlintool
nlparci
nlpredict
lsqnonneg
clc;clear
dat=[
0.8853 87.7513
0.9943 78.0249
1.3615 75.3307
2.8419 74.9392
5.7365 74.4935
9.5169 73.4786
13.467 71.6243
16.9629 68.6216
19.5727 64.4005
21.1302 59.2471
21.708 53.649
21.5302 48.0889
20.8489 42.8944
19.8802 38.2365
18.7755 34.1572
17.6438 30.6373
16.5316 27.6132
15.4804 25.0207
14.505 22.7949
13.6031 20.8748
12.7786 19.2113
12.0275 17.7627
11.3434 16.4944
10.7188 15.3775
10.1497 14.3886
9.6304 13.5086
9.1559 12.7217
8.7206 12.0156
8.3209 11.3783
7.9534 10.8008];
X=dat(:,1);
Y=dat(:,2);
sp=csaps(Y,X);
R=CORRCOEF(sp.breaks,Y)
plot(Y,X,'o');hold on; fnplt(sp,'r');hold off
xlabel('Y'),ylabel('X')
最好能把你的问题列出来,有针对性.
还可以用非线性回归函数:
nlinfit
nlintool
nlparci
nlpredict
lsqnonneg