Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
character recognition,nntool

Subject: character recognition,nntool

From: dipti chaudhary

Date: 3 Jan, 2013 07:37:13

Message: 1 of 1

Hi All,
I want to do character recognition. I have the following code. But, after i run this program at Matlab. I am still unable to recognition any number.
What is the step taken to make the below coding works?
please help me?

clc;
close all;
clear all;
letter1 = [1 0 0 0 1 ...
           1 0 0 0 1 ...
           1 0 0 0 1 ...
           1 0 0 0 1 ...
           1 0 0 0 1 ...
           1 0 0 0 1 ...
           1 0 0 0 1]';
       
letter2 = [1 0 0 0 1 ...
           0 1 1 1 0 ...
           1 1 1 1 0 ...
           1 1 1 0 1 ...
           1 1 0 1 1 ...
           1 0 1 1 1 ...
           0 0 0 0 0]';
       
letter3 = [1 0 0 0 1 ...
           0 1 1 1 0 ...
           1 1 1 1 0 ...
           1 1 0 0 1 ...
           1 1 1 1 0 ...
           0 1 1 1 0 ...
           1 0 0 0 1]';
 letter4 = [1 1 1 0 1 ...
            1 1 0 0 1 ...
            1 0 1 0 1 ...
            0 1 1 0 1 ...
            0 0 0 0 0 ...
            1 1 1 0 1 ...
            1 1 1 0 1]';
        
 letter5 = [0 0 0 0 0 ...
            0 1 1 1 1 ...
            0 1 1 1 1 ...
            0 0 0 0 1 ...
            1 1 1 1 0 ...
            0 1 1 1 0 ...
            1 0 0 0 1]';
        
 letter6 = [1 0 0 0 1 ...
            0 1 1 1 1 ...
            0 1 1 1 1 ...
            0 0 0 0 1 ...
            0 1 1 1 0 ...
            0 1 1 1 0 ...
            1 0 0 0 1]';
        
  letter7 = [0 0 0 0 0 ...
             1 1 1 1 0 ...
             1 1 1 1 0 ...
             1 1 1 0 1 ...
             1 1 0 1 1 ...
             1 0 1 1 1 ...
             0 1 1 1 1]';
          letter8 = [1 0 0 0 1 ...
             0 1 1 1 0 ...
             0 1 1 1 0 ...
             1 0 0 0 1 ...
             0 1 1 1 0 ...
             0 1 1 1 0 ...
             1 0 0 0 1]';
         
  letter9 = [1 0 0 0 1 ...
             0 1 1 1 0 ...
             0 1 1 1 0 ...
             0 1 1 1 0 ...
             0 1 1 1 0 ...
             0 1 1 1 0 ...
             1 0 0 0 1]';
         
  letter0 = [1 0 0 0 1 ...
             0 0 0 0 0 ...
             0 1 1 1 0 ...
             0 1 1 1 0 ...
             0 1 1 1 0 ...
             0 0 0 0 0 ...
             1 0 0 0 1]';


 P = [letter1,letter2,letter3,letter4,letter5,letter6,letter7,letter8,letter9,letter0];
  T = eye(10);
  
  S1 = 10;
  [R,Q] = size(P);
  [S2,Q] = size(T);

 net = newff(minmax(P),[S1 S2],{'logsig' 'logsig'},'traingdx');
  net.performFcn = 'sse';
  net.trainParam.goal = 0.1;
  net.trainParam.show = 20;
  net.trainParam.epochs = 5000;
  net.trainParam.mc = 0.95;
  [net,tr] = train(net,P,T);
  
  noisyJ = P(:,10)+randn(35,1)*0.2;
  plotchar(noisyJ);
  A2 = sim(net,noisyJ);
  A2 = compet(A2);
  answer = find(compet(A2) == 1);
  plotchar(P(:,answer));
  
 
 
 

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us