- 99
- 0
- 约小于1千字
- 约 2页
- 2017-05-21 发布于河南
- 举报
基于支持向量机的二次函数在Matlab中的应用
format compact;
x = (-1:0.1:1);
y = -x.^2;
model = svmtrain(y,x,-s 3 -t 2 -c 2.2 -g 2.8 -p 0.01);
. WARNING: using -h 0 may be faster
optimization finished, #iter = 104
nu = 0.224906
obj = -0.675055, rho = 0.698514
nSV = 9, nBSV = 2
[py , mse] = svmpredict( y , x , model );
Mean squared error = 9.52768e-005 (regression)
Squared correlation coefficient = 0.999184 (regression)
figure;
plot(x , y, o);
hold on;
plot(x, py, r*);
legend(原始数据,回归数据);
grid on;
testx = [1.1;1.2;1.3];
display(真实数据)
真实数据
testy = -testx.^2
testy =
-1.2100
-1.4400
-1.6900
[ ptesty ,
原创力文档

文档评论(0)