Train and Simulate Newff
5 次查看(过去 30 天)
显示 更早的评论
Dear,
Here below is a problem with requirements. I tried in same way as guided but unable to understand how to Train and then simulate using newff .
If any one please help/guide me in this regard.
Thanks
Question: Training a feedforward NN to learn the surface given by the expression:
z = cos (x) sin (y)
defined on the square−2≤x≤2,−2≤y≤2.
>>>>> You can generate and plot the above defined surface using the following Matlab commands:
x = -2:0.25:2; y = -2:0.25:2; z = cos(x)'*sin(y); mesh(x,y,z)
xlabel('x axis'); ylabel('y axis'); zlabel('z axis');
title('surface z = cos(x)sin(y)');
2.3. Now the tasks for this assignment:
(a) Design a two layer (one hidden and one output) feedforward network to learn target function.
(b) Try learning the function using different number of NN units in the hidden and output layers. E.g. 25 in the hidden and 15 in the output, and then repeat the experiment twice, with reduced and increased number of units in the two layers. For each of the three cases show (using plot) and comment on the performance of our NN by employing the function “sim” as in the tutorial part of this assignment.
(c) Show and comment on the system performance by repeating the above experiment (just once) using Levenberg-Marquardt and Gradient Descent learning schemes.
0 个评论
采纳的回答
Greg Heath
2016-1-12
It looks like this is a straightforward curve-fitting problem which will output z given the 2-D input [ x; y ]. With [-2:0.25:2] line grids of 17 points per line, N= 17^2 = 289 points.
[ 2 289 ] = size(input)
[ 1 289 ] = size(height)
Therefore use
FITNET (calls feeforwardnet) or the obsolete NEWFIT (calls NEWFF)
The single valued output z for the point (x,y) using FITNET is
z = net([x;y])
using NEWFIT it is probably
z = sim(net,[x;y])
Hope this helps.
Thank you for formally accepting my answer
Greg
0 个评论
更多回答(1 个)
Walter Roberson
2015-8-22
I see nothing in the question that requires you to use newff(), a routine that is so old that it has been removed from the MATLAB documentation. You are asked to create a Feed Forward Network, not to use newff().
There are several routines to create Feed Forward Networks now. The best one to use depends on what you need to do with the network. Your assignment does not specify what you need to do with the network, only that it has to "learn" the surface. Is the "learn"ing for the purpose of Classification? For the purpose of Prediction? You cannot measure the "system performance" unless you know what you are comparing against, which your assignment does not say.
2 个评论
Walter Roberson
2015-8-24
It looks like sim() was used to get outputs for a given input. See http://www.mathworks.com/matlabcentral/answers/222457#answer_181929 for how to do that with a more modern Feed Forward Network
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!