Matlab中libsvm回归怎么做时间序列的单步和多步预测

 我来答
time陌言成殇
2014-12-14 · TA获得超过8.4万个赞
知道大有可为答主
回答量:1.4万
采纳率:91%
帮助的人:8951万
展开全部

您好,很高兴为您解答。


a(1)=0;
for i=2:220
  a(i)=0.6*a(i-1)+randn;
end

train_t = 1:200;
train = a(train_t);
train_t = train_t';
train = train';

test_t = 1:203;
test=a(test_t);
test_t = test_t';
test = test';

[bestmse,bestc,bestg] = SVMcgForRegress(train,train_t,-3,11,-7,1,3,0.5,0.5,0.1);
cmd = ['-c ',num2str(bestc),' -g ',num2str(bestg),' -p 0.01 -s 3'];

model = svmtrain(train,train_t,cmd);
[trainpre,trainmse] = svmpredict(train,train_t,model);

figure;
hold on;
plot(train);
plot(trainpre,'r');
title('原来的训练数据的拟合1-200');
legend('原来的训练数据','训练数据预测拟合数据');
hold off

[testpre,testmse] = svmpredict(test,test_t,model);
figure;
hold on;
plot(test);
plot(testpre,'r');
title('测试数据的预测1-203');
legend('测试数据','测试数据预测拟合数据');
hold off


如若满意,请点击右侧【采纳答案】,如若还有问题,请点击【追问】

希望我的回答对您有所帮助,望采纳!

                                                                                                                            ~ O(∩_∩)O~

我是舞三
推荐于2016-03-22 · 贡献了超过124个回答
知道答主
回答量:124
采纳率:100%
帮助的人:21.1万
展开全部
使用符号运算符 | 或者命令or
比如:
lgc1=ture;
lgc2=false;
lgc1 | lgc2
lgc1 | lgc1
or(lgc1,lgc2)
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式