云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > matlab、lingo程序代码17-神经网络

matlab、lingo程序代码17-神经网络

  • 62 次阅读
  • 3 次下载
  • 2026/4/24 10:56:34

神经网络

P=-1:0.1:1; for i=1:21

T(i)=sin(P(i).*pi); end s=3:8; res=1:6; for i=1:6

net=newff(minmax(P),[s(i),1],{'tansig','tansig'},'traingdx'); net.trainParam.epochs=2000; net.trainParam.goals=0.001; net=train(net,P,T); y=sim(net,P); error=y-T;

res(i)=norm(error); end

plot(P,T,'o');hold on yend=sim(net,P); plot(P,yend,'r*') P=[]

%被分类的对象数据 T=[ ]';

%描述分类结果 rang=[0 1;..;0 1];

%描述输入向量的最大值和最小值

net=newff(rang,[ , ],{'tansig','logsig'},'trainlm');

%tansig输出范围是[-1 1] logsig输出范围是[0 1]

%在三层网络中,隐含层神经元个数n2和输入层神经元个数n1关系约为%net=newff(PR,[S1 S2...SNl],{TF1 TF2...TFNl},BTF,BLF,PF) takes, %PR -- R x 2 matrix of min and max values for R input elements %Si -- Size of ith layer, for Nl layers

%TFi -- Transfer function of ith layer, default = 'tansig'

%TF -- Backpropagation network training function, default = 'traingdx'

%BLF -- Backpropagation weight/bias learning function, default = 'learngdm' %PF -- Performance function, default = 'mse' net.trainParam.epochs=1000; net.trainParam.goal=0.01; LP.lr=0.1;

net=train(net,P,T); P_test=[]';

n2=2*n1+1 Y=sim(net,P_test)

P=[0.270 0.142 6.46 5.5 35.8 21 1.03; 0.171 0.115 3.46 6.3 33.0 60 0.78; 0.114 0.101 2.43 6.4 26.5 25 1.13; 0.173 0.123 3.30 5.8 28.9 65 1.09; 0.145 0.131 3.28 6.0 28.5 25 1.03; 0.173 0.140 3.45 5.8 33.4 60 0.98; 0.250 0.177 5.51 7.2 42.5 45 0.93; 0.237 0.189 5.37 6.1 32.9 27 1.00; 0.319 0.227 7.04 5.8 35.9 24 1.03; 0.163 0.124 3.73 6.2 30.6 61 1.28]'; net=newsom(minmax(P),[6 4]); a=[10 100 1000]; yc=ones(3,10); for i=1:3

yc(i,:)=rands(1,10);

net.trainParam.epochs=a(i); net=train(net,P); y=sim(net,P); yc(i,:)=vec2ind(y); end

P=[-0.5 -0.6 0.7;0.8 0 0.1]; T=[1 1 0];

net=newp([-1 1;-1 1],1);

%newp的调用格式为:net=newp(PT,1,'hardlims','learnpn') PT是一个R*2维的矩阵 handle=plotpc(net.iw{1},net.b{1});

%返回画线的句柄,下一次绘制分类线时将旧的删除 net.trainParam.epochs=10; %设置训练次数最大为10次 net=train(net,P,T);

Q=[0.6 0.9 -0.1;-0.1 -0.5 0.5]; Y=sim(net,Q);

plot(P(1,:),P(2,:),'*b');hold on plotpv(Q,Y);

handle=plotpc(net.iw{1},net.b{1},handle);

搜索更多关于: matlab、lingo程序代码17-神经网络 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

神经网络 P=-1:0.1:1; for i=1:21 T(i)=sin(P(i).*pi); end s=3:8; res=1:6; for i=1:6 net=newff(minmax(P),[s(i),1],{'tansig','tansig'},'traingdx'); net.trainParam.epochs=2000; net.trainParam.goals=0.001; net=train(net,P,T); y=sim(net,P); error=y-T; res(i)=norm(error); end plot(P,T,'o');hold on yend=sim(net,P)

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com