EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
有关MATLAB神经网络预测的问题,请问我这个最后输出的五个值分别是未来五年的值吗?% w5 M1 c9 q1 R
3 | n3 P& |0 M$ i2 d2 e2 w h, T* P( g) I) D, r
clc+ Z. V) W2 `0 S' e' M4 ~3 N
clear all
2 e" D/ g" e3 x( ?%%' H: b! Y& A' d- }
%输入数据和输出数据; B8 `5 w7 m% c' e* q$ n1 @
P = [24358, 24242, 26377;
! k( F$ P# E3 O, f3 J0 P/ z24242, 26377, 23125.2;
1 c4 w# [# E9 B3 y/ v& ?9 Z$ ]: d26377, 23125.2, 29797.6;4 _* q, `6 h/ M1 b& K/ G
23125.2, 29797.6, 22213.6;
u5 X" k0 `3 J% J% H5 J29797.6, 22213.6, 28373.3;" u, U1 o! @2 f" S! ~9 X
22213.6, 28373.3, 26839.5;
* `' c; ~; z( j4 t- E+ L X! Q28373.3, 26839.5, 26263.9];
# G2 o6 z( V" q- {T = [23125.2 29797.6 22213.6 28373.3 26839.5 26263.9 26900.8];
0 E2 R, H, z) ^%归一化数据
; f5 N! u% J1 o* c6 K' h1 v7 ]1 f* F# d[input,inputps] = mapminmax(P,0,1);+ B) c3 d4 r5 M6 }
[output,outputps] = mapminmax(T,0,1);% t8 \+ G( m" c2 `
%%7 \% y9 ~' e; j% L# s
%构建BP神经网络$ u& ]0 s7 i) P6 m
net = newff(input',output,[4,6]);
0 W8 e5 [' b I%训练神经网络
1 ]* b: F7 v/ f. onet.trainParam.epochs = 100000;
# K$ Z/ Z7 ]- Q4 a6 D6 P/ W Anet.trainParam.goal = 0.000001;2 A. _/ f2 Z7 X! r$ y& \! t; ?
net.trainParam.lr = 0.1
9 d, `4 N+ s8 `net = train(net,input',output);$ N, J3 B7 Z& V& u
%%0 ^6 J: _- |0 |1 _8 H/ q8 s! t5 Y
%%预测结果
0 f' t% P7 L- M) s8 M: [, g%神经网络输出4 |$ |5 f8 k7 B- h
sim_out_1 = sim(net,[ 28373.3, 26839.5, 26263.9]');: G$ \: `' S9 Y! }9 C6 z( h
sim_out_2 = sim(net,[ 26839.5, 26263.9, sim_out_1]');
]7 y5 S( s4 ^; [' O, t- ~sim_out_3 = sim(net,[ 26263.9, sim_out_1, sim_out_2]');
' _$ x& O" O7 _3 Asim_out_4 = sim(net,[ sim_out_1, sim_out_2, sim_out_3]');* A" v+ ^8 R6 N. [ H
sim_out_5= sim(net,[ sim_out_2, sim_out_2, sim_out_4]');: V3 {4 ?& ~5 d$ x
%反归一化,最终结果
) r2 ?" c z; [: \& M; csim_out = mapminmax('reverse',sim_out_1,outputps)
# p, V1 y7 I* ~( ssim_out = mapminmax('reverse',sim_out_2,outputps)4 Y$ p* w8 c1 J( d% Q9 r A
sim_out = mapminmax('reverse',sim_out_3,outputps)
) h( p' L& [! Lsim_out = mapminmax('reverse',sim_out_4,outputps)
X, g0 s2 U5 ?: x5 h# {& U! msim_out = mapminmax('reverse',sim_out_5,outputps) 3 ?0 N6 }6 C8 M& U
如果不对要怎么才能输出未来5年的数据?求指教,万分感谢!$ ~ U) [) h+ f' Q0 F/ `3 H: P
最后还有一个问题,为什么我每次运行输出的结果都不一样呢?求指教 0 J& b! Q/ D$ y+ T
$ I8 t& W: y6 V& d! |
/ K" d2 v8 [* y/ K- n, p
; R# A2 `0 G3 M4 e4 v' { |