这样编的matlab神经网络预测为什么等不到好效果,得出来的系统在所有年份输出都是同一个数!
clearclcdata;inputSampledata=1990:1:2009;outputSampledata=[257.29,285.85,322.4,398.87...
clear
clc
data;
inputSampledata=1990:1:2009;
outputSampledata=[257.29, 285.85, 322.4, 398.87, 435.15, 483.06, 500.98, 529.79, 552.35, 582.71, 606.73, 651.79, 706.85, 718.39, 795.32, 848.49, 929.15, 1026.5, 1118.62, 1152.38
];
%建立网络,设定参数
gwwnet=newff(minmax(inputSampledata),[1,1],{'tansig','purelin'},'traingdm');%建立网络
gwwnet.trainParam.show = 50;%迭代显示频率
gwwnet.trainParam.lr = 0.05;%学习率
gwwnet.trainParam.epochs = 5000;%学习次数
gwwnet.trainParam.goal = 1e-4;%收敛阈值
%标准化处理,把数据转换到[-1,1]
[input,mininput,maxinput,output,minoutput,maxoutput] = premnmx(inputSampledata,outputSampledata);
%训练
[gwwnet,tr]=train(gwwnet,input,output);
y=sim(gwwnet,input);
%将输出反归一化
nnoutput = postmnmx(y,minoutput,maxoutput);
%plot
time=1990:1:2009;
plot(time,outputSampledata,'-',time,nnoutput,'o');
legend('真实数据','网络输出');
xlabel('年份');ylabel('变量'); 展开
clc
data;
inputSampledata=1990:1:2009;
outputSampledata=[257.29, 285.85, 322.4, 398.87, 435.15, 483.06, 500.98, 529.79, 552.35, 582.71, 606.73, 651.79, 706.85, 718.39, 795.32, 848.49, 929.15, 1026.5, 1118.62, 1152.38
];
%建立网络,设定参数
gwwnet=newff(minmax(inputSampledata),[1,1],{'tansig','purelin'},'traingdm');%建立网络
gwwnet.trainParam.show = 50;%迭代显示频率
gwwnet.trainParam.lr = 0.05;%学习率
gwwnet.trainParam.epochs = 5000;%学习次数
gwwnet.trainParam.goal = 1e-4;%收敛阈值
%标准化处理,把数据转换到[-1,1]
[input,mininput,maxinput,output,minoutput,maxoutput] = premnmx(inputSampledata,outputSampledata);
%训练
[gwwnet,tr]=train(gwwnet,input,output);
y=sim(gwwnet,input);
%将输出反归一化
nnoutput = postmnmx(y,minoutput,maxoutput);
%plot
time=1990:1:2009;
plot(time,outputSampledata,'-',time,nnoutput,'o');
legend('真实数据','网络输出');
xlabel('年份');ylabel('变量'); 展开
2个回答
展开全部
【1】把以下程序另存为myear.m
%=====================
function myear(myear)
for m=1:12
calendar(myear,m)
end
%===================
【2】运行,例如
>> myear(2006)
【3】运行结果
Jan 2006
S M Tu W Th F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 0 0 0 0
0 0 0 0 0 0 0
Feb 2006
S M Tu W Th F S
0 0 0 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 0 0 0 0
0 0 0 0 0 0 0
Mar 2006
S M Tu W Th F S
0 0 0 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31 0
0 0 0 0 0 0 0
Apr 2006
S M Tu W Th F S
0 0 0 0 0 0 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 0 0 0 0 0 0
May 2006
S M Tu W Th F S
0 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 0 0 0
0 0 0 0 0 0 0
Jun 2006
S M Tu W Th F S
0 0 0 0 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 0
0 0 0 0 0 0 0
Jul 2006
S M Tu W Th F S
0 0 0 0 0 0 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 0 0 0 0 0
Aug 2006
S M Tu W Th F S
0 0 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31 0 0
0 0 0 0 0 0 0
Sep 2006
S M Tu W Th F S
0 0 0 0 0 1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
0 0 0 0 0 0 0
Oct 2006
S M Tu W Th F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 0 0 0 0
0 0 0 0 0 0 0
Nov 2006
S M Tu W Th F S
0 0 0 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 0 0
0 0 0 0 0 0 0
Dec 2006
S M Tu W Th F S
0 0 0 0 0 1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31 0 0 0 0 0 0 今赢网络,为您解答。
it笑bǎoノwg唯fr庖蜘≥ヴcn07886586032011-08-02 18:28:34
%=====================
function myear(myear)
for m=1:12
calendar(myear,m)
end
%===================
【2】运行,例如
>> myear(2006)
【3】运行结果
Jan 2006
S M Tu W Th F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 0 0 0 0
0 0 0 0 0 0 0
Feb 2006
S M Tu W Th F S
0 0 0 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 0 0 0 0
0 0 0 0 0 0 0
Mar 2006
S M Tu W Th F S
0 0 0 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31 0
0 0 0 0 0 0 0
Apr 2006
S M Tu W Th F S
0 0 0 0 0 0 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 0 0 0 0 0 0
May 2006
S M Tu W Th F S
0 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 0 0 0
0 0 0 0 0 0 0
Jun 2006
S M Tu W Th F S
0 0 0 0 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 0
0 0 0 0 0 0 0
Jul 2006
S M Tu W Th F S
0 0 0 0 0 0 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 0 0 0 0 0
Aug 2006
S M Tu W Th F S
0 0 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31 0 0
0 0 0 0 0 0 0
Sep 2006
S M Tu W Th F S
0 0 0 0 0 1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
0 0 0 0 0 0 0
Oct 2006
S M Tu W Th F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 0 0 0 0
0 0 0 0 0 0 0
Nov 2006
S M Tu W Th F S
0 0 0 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 0 0
0 0 0 0 0 0 0
Dec 2006
S M Tu W Th F S
0 0 0 0 0 1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31 0 0 0 0 0 0 今赢网络,为您解答。
it笑bǎoノwg唯fr庖蜘≥ヴcn07886586032011-08-02 18:28:34
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询