为了账号安全,请及时绑定邮箱和手机立即绑定

请问该如何使用工具箱?求具体说明过程。

请问该如何使用工具箱?求具体说明过程。

BIG阳 2023-04-22 21:17:56
随机生成x1,x2,然后训练y(x1,x2)=sin(a*pi*x1)cos(b*pi*x2)。当运行到net = train(net,P,T); 报错:??? Error using ==> subsindexFunction 'subsindex' is not defined for values of class 'network'.Error in ==> test at 20net = train(net,P,T); 求问如何使用train去训练多维input的情况?程序如下train=rand(100,2)*2-1;traindata=[trainx1,trainx2,sin(0.4*pi.*trainx1).*cos(0.8*pi.*trainx2)];% Construct training signal P and T P=traindata(:,1:2)'; T=traindata(:,3)'%Plot training signal i=find(T>0.5); j=find(T<=0.5); x=P(1,i); y=P(2,i); x1=P(1,j); y1=P(2,j); plot(x,y,'o',x1,y1,'+') %Push a key to continue disp('Push a key to continue') pause %Define a neural network and train it with the training data net = newff([-0.5 0.5; -0.5 0.5], [18 1], {'tansig' 'logsig'}); net.trainParam.epochs = 5000; net = train(net,P,T); %Generate input data randomly x2=rand(1,5000)-0.5; y2=0.8*rand(1,5000)-0.4; P2=[x2;y2]; %Simulate the trained network T2 = sim(net,P2); %Check the generalization ability of the trained network ii=find(T2>0.5) plot(x,y,'o',x1,y1,'+',x2(ii),y2(ii),'o')谢谢。
查看完整描述

1 回答

?
慕慕森

TA贡献1856条经验 获得超17个赞

你的train函数已经被你重载为变量了,当然不能训练了。

查看完整回答
反对 回复 2023-04-25
  • 1 回答
  • 0 关注
  • 133 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信