Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2009-03-02
年龄: 40
帖子: 1
声望力: 0 ![]() |
![]()
希望有高手可以指点一下,在做一道题目要求用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 |
![]() |
![]() |
![]() |
主题工具 | |
显示模式 | |
|
|
![]() |
||||
主题 | 主题作者 | 版面 | 回复 | 最后发表 |
求灰色预测工具箱? | 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 |