SIMULATION OF COMPARATOR IN ANN 1. Wrote the code in MATLAB and stored it as an M file. 2. The code for generating input and output of the comparator is clc; clear; input=10*rand(1,100); for i=1:100 if (input(1,i)>5) a(1,i)=5; else a(1,i)=0; end end b=[input;a]
3.Run the program.
5.Then select IMPORT in the NNTOOL box.Then import the required input and output variables.
4.Select nntool from the start menu of matlab.
After selection close that window.
5.Click on the NEW button.
6. Select input and target. Define the number of neurons. Then click on CREATE. After that close that box. 7.In the Network/data manager box double click on the network.
A new window is opened. 8.click on train and assigned the proper input and output variables.Then click train network.
9.Then simulate the network. 10.click on the view weight bar we can saw the weight.
11.click on the EXPORT bar.
12.The required matrix are transfered to the workspace .
13.Then use sim command to see the output.