首页 > > 详细

解析R编程、Matlab编程讲解留学生、讲解R编程、Matlab程序辅导

clear all
close all
a=[ 5251.987168 5038.516576 4828.626208 4675.97824 4560.946048 4487.94064
4554.829888 5030.937856 7369.10032 9467.192512 10021.70598 10277.94246
8571.962464 8034.96064 9957.467488 10292.30214 10352.35005 10142.91808
8527.373152 9342.385024 9295.833472 8893.96 8045.075296 7034.336416;
6256.688608 6036.877216 5882.488768 5716.607968 5591.56096 5506.471552
5541.272992 5849.866048 7780.302784 9763.125664 10224.54438 10433.3584
8633.089408 7901.208928 9750.236896 9987.42064 10031.65658 9880.047808
8129.104384 8847.783424 8933.134336 8641.465984 7890.625984 6981.987328;
6156.03952 5929.572832 5751.568768 5619.505024 5517.654016 5443.170592
5488.210912 5787.032992 7636.017376 9510.815296 9877.165984 10017.91187
8320.167808 7737.392512 9726.917536 10156.51754 10350.84064 10266.6831
8593.368448 9319.162144 9382.456576 9072.026848 8332.112512 7369.189888;
6537.543904 6262.753792 6078.51808 5928.451552 5805.310912 5727.390112
5798.634496 6053.652832 8048.306848 9997.5616 10397.50566 10588.03936
8760.406528 8046.404704 9939.014656 10302.69059 10485.38685 10173.42438
8352.46 9042.814336 9053.11936 8773.930048 8038.407808 7103.164864];
L=length(a);
u0=min(min(a));
U0=max(max(a));
b=(a-u0)/(U0-u0);

samplelist=b(1:3,1:end);
expectlist=b(4,1:end);
sampleLength=size(samplelist,2);

sam1=samplelist(:,1:18);
sam2=samplelist(:,19:end);
ex1=expectlist(1:18);
ex2=expectlist(19:end);

net=newff(minmax(sam1),[20,1],{'tansig''purelin'},'trainlm');
net.trainParam.show=50;
net.trainParam.epochs=1000
net.trainParam.goal=1e-8;
net.trainParam.mu=0.01;
net=train(net,sam1,ex1);


y1=sim(net,samplelist);
e1=expectlist-y1;
y=y1*(U0-u0)+u0;
e=a(4,1:end)-y;

figure(1)
plot(expectlist,'r')
hold on
plot(y1,'b-.')
ylabel(' ')
xlabel(' /t')

figure(2)
plot(a(4,1:end),'r')
hold on
plot(y,'b-.')
ylabel(' ')
xlabel(' /t')

figure(3)
plot(e1)
ylabel(' ')
xlabel(' /t')
axis([0 25 -1 1])

figure(4)
plot(e)
ylabel(' ')
xlabel(' /t')
axis([0 25 -200 200])
 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!