Neural Network Toolbox | ![]() ![]() |
Example
Here is a simple problem defining a set of inputs p
and corresponding targets t
.
The code below designs a linear layer to solve this problem.
We can test the network on our original inputs with sim
.
The results returned show the network has solved the problem.
Call gensim
as follows to generate a Simulink version of the network.
The second argument is -1 so the resulting network block samples continuously.
The call to gensim
results in the following screen. It contains a Simulink system consisting of the linear network connected to a sample input and a scope.
To test the network, double-click on the Input 1
block at left.
The input block is actually a standard Constant block. Change the constant value from the initial randomly generated value to 2
, and then select Close.
Select Start from the Simulation menu. Simulink momentarily pauses as it simulates the system.
When the simulation is over, double-click the scope at the right to see the following display of the network's response.
Note that the output is 3, which is the correct output for an input of 2.
![]() | Block Generation | Exercises | ![]() |