📄 rawlssvm.asv
字号:
clear
x=0:49;
%___________________________________________________________________%
%oflinelssvm%
load yy4;
for i=1:2:100
Y((i+1)/2)=(yy4(i));
end
subplot(221)
plot(x,Y,'-o');
xlabel('样本数');
ylabel('pH');
title('离线LS-SVM模型辨识结果');
hold on
gam=900;
sig2=0.0142;
type='function estimation';
%[alpha,b]=trainlssvm({x',Y',type,gam,sig2,'RBF_kernel','preprocess'});
%Xt=normrnd(0,0.0001,151,1);
%Yt=sim
tic
model=initlssvm(x',Y',type,gam,sig2,'RBF_kernel');
model=robustlssvm(model);
Yd=simlssvm(model,x');
plot(x,Yd,'-*');
legend('实际中和曲线','离线拟合输出');
hold off;
offlinelssvm_traintime=toc
subplot(223);
plot(x,(Y'-Yd)./Y');
xlabel('离线辨识相对误差');
offMSE=sqrt(mse(Y'-Yd))*sqrt(50)
%_____________________________________________%
%onlinelssvm%
subplot(222);
plot(x,Y,'-o');
xlabel('样本数');
ylabel('pH');
hold on
title('在线LS-SVM模型辨识结果');
gam=600;
sig2=0.012;
type='function estimation';
%[alpha,b]=trainlssvm({x',Y',type,gam,sig2,'RBF_kernel','preprocess'});
%Xt=normrnd(0,0.0001,151,1);
%Yt=sim
tic
model=initlssvm(x',Y',type,gam,sig2,'RBF_kernel');
model=robustlssvm(model);
Yd=simlssvm(model,x');
plot(x,Yd,'-*');
hold off;
legend('实际中和曲线','在线拟合输出');
onlinelssvm_traintime=toc
subplot(224);
plot(x,(Y'-Yd)./Y');
xlabel('在线辨识相对误差');
onMSE=sqrt(mse(Y'-Yd))*sqrt(50)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -