Matlab学习

两层前馈网络的实现

clear all;
x=[0 1 2 3 4 5 6 7 8];
t=[0 0.84 0.91 0.14 -0.77 -0.96 -0.28 0.66 0.99];
plot(x,t,'o');
net=feedforwardnet(10); %创建两层前反馈网络,有10元
net=configure(net,x,t);
y1=net(x)
plot(x,t,'o',x,y1,'x');
%%此时的y1: = -1.8260   -0.1460    1.5486    2.1347    3.5209    4.6727    4.3351    3.4458    4.0257
net=train(net,x,t); %对网络进行训练
y2=net(x);
plot(x,t,'o',x,y1,'x',x,y2,'*');
%%此时的y2: -0.5608    0.8365   -0.3636    0.1337   -0.7477   -0.9427   -0.3031    0.6589  0.9676

Be the First to comment.

Leave a Comment

您的电子邮箱地址不会被公开。

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理