求预测一组数据的bp神经网络模型的matlab代码

208.72 205.69 231.5 242.78 235.64 218.41
101.4 101.4 101.9 102.4 101.9 102.9
140 137 112 125 213 437.43

分别用神经网络预测这三组数据后面的五个数据,求代码,,,分别哦,,,,

用matlab求预测一组数据的bp神经网络模型,可以分
1、给定已经数据,作为一个原始序列;
2、设定自回归阶数,一般2~3,太高不一定好;
3、设定预测某一时间段
4、设定预测步数
5、用BP自定义函数进行预测
6、根据预测值,用plot函数绘制预测数据走势图
其主要实现代码如下:
clc
% x为原始序列(行向量)
x=[208.72 205.69 231.5 242.78 235.64 218.41];
%x=[101.4 101.4 101.9 102.4 101.9 102.9];
%x=[140 137 112 125 213 437.43];

t=1:length(x);
% 自回归阶数
lag=3;
%预测某一时间段
t1=t(end)+1:t(end)+5;
%预测步数为fn
fn=length(t1);
[f_out,iinput]=BP(x,lag,fn);
P=vpa(f_out,5);
A=[t1' P'];
disp('预测值')
disp(A)
% 画出预测图
figure(1),plot(t,iinput,'bo-'),hold on
plot(t(end):t1(end),[iinput(end),f_out],'rp-'),grid on
title('BP神经网络预测某地铁线路客流量')
xlabel('月号'),ylabel('客流量(百万)');
运行结果:

温馨提示:答案为网友推荐,仅供参考