Wednesday, November 28, 2012

Neural network matlab Code

Examples of neural network using matlab

Neural Network tool is one of the toolbox in matlab. Neural Network operates Artificial intelligence approach. Most research works are used this concept.This concept mostly working in pattern recognition,classification and prediction.We give some notes, how to use neural network in matlab.
Matlab is Research tool ,mainly used for research and researchers.you have use following operations for study the Neural Network.
Neural Network contain Three layers.
  1. Input Layer
  2. Hidden Layer
  3. Output Layer
Use following operation in Matlab for train the data on NeuralNetwork.
  1. Goto matlab command window.
  2. Type nftool (nftool is keyword, for load the Neural network Toolbox on matlab).
  3. Then you sea following screen.


4. Load The data s from work space.


5.Set The hidden layers of neural network.



5.Then goto Next.Then press Train button train your data.


6.Then goto 2 Next Button then press generate m file.This m file is your training file.


This method for directly using Neural Network Toolbox.
In below create Neural network with using NN toolbox codes and syntax's.
  1. Training use as following code
>> input_data = [1 2;2 3;2 2;4 2;6 6]; % Input matrix
>> output_data = [3;5;4;6;12]; %output vector
>> net = newff(input_data',output_data',20); % design a NN Structure
>> net = train(net,input_data',output_data');% Train the data's
2. Test the data's on NN.
>> pred = sim(net,[2;3]) % test the data's on neural network
 
pred =4.95

This "sim" is a function ,for test the data's on networks.you may have use large amount of data's to train and test on neural network

 

No comments:

Post a Comment