Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
 
 
主题工具 显示模式
旧 2009-03-02, 22:56   #1
ratbaby
初级会员
 
注册日期: 2009-03-02
年龄: 40
帖子: 1
声望力: 0
ratbaby 正向着好的方向发展
默认 [求助]怎么做sequential mode network

希望有高手可以指点一下,在做一道题目要求用sequential mode模拟一条曲线。 一般用batch mode还可以,sequential mode 有点没头绪了,特别是要求用50个neuron 的时候得到的曲线我觉得不太对。
-------------------------------------------------------------------------------------------------------------------------------------

clc;
clear;
close all;

%Generating training data and desired output
x=-1:0.05:1;
y=0.8*sin(2*pi*x)+cos(pi*x);

% Test the MLP, net_output is the output of the MLP, ytest is the desired output.
xtest=(2*rand(1,100)-1); %generate randon value from -1 to 1
xtest=sort(xtest','ascend')';
ytest=0.8*sin(2*pi*xtest)+cos(pi*xtest);

%define hidden neurons
n=[1 2 3 4 5 6 7 8 9 10 50];

for j=1:length(n);
%Create network
net=newff(minmax(x),[n(j),1],{'tansig' 'purelin'},'trainlm');

%Train the MLP
net.adaptFcn = 'trains'; % Specify the sequential training
net.adaptParam.passes = 1000; % Specify the number of epoch
for i = 1 : length(x) % Convert the input and output data
NP{i} = x(i); % into cell array
NY{i} = y(i);
end
net = adapt(net,NP,NY);

net_output=sim(net,xtest);

% Plot out the test results
figure;
plot(xtest,ytest,'ro');
hold on;
plot(xtest,net_output,'b-');
hold off

end
ratbaby 当前离线   回复时引用此帖
 


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码


相似的主题
主题 主题作者 版面 回复 最后发表
求灰色预测工具箱? Amani 数学 0 2009-04-22 01:13
[求助]关于使用MATLAB仿真的步骤 hdy6174 MATLAB论坛 0 2009-03-26 10:10
急需解决问题,关于数字信号处理的题目 chebyshev_hh MATLAB论坛 0 2009-01-02 13:29
[求助]怎样固定command window窗口? xrhcf MATLAB论坛 0 2008-12-02 20:41
[求助]一个关于符号运算的问题 me4047 MATLAB论坛 3 2008-11-29 01:31


所有时间均为北京时间。现在的时间是 09:02


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.