try to simulate neural network in Matlab by myself
===

i tried to create a neural network that estimate y = x ^ 2 so i create a fitting neural network and give some sample for input and out put. then i tried to come this network to c++. but the result is different i tried to find why this happened. i wrote this command in matlab :

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71

and my outputs are :

0 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400 441 484 529 576 625 676 729 784 841 900 961 1024 1089 1156 1225 1296 1369 1444 1521 1600 1681 1764 1849 1936 2025 2116 2209 2304 2401 2500 2601 2704 2809 2916 3025 3136 3249 3364 3481 3600 3721 3844 3969 4096 4225 4356 4489 4624 4761 4900 5041 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400 441 484 529 576 625 676 729 784 841 900 961 1024 1089 1156 1225 1296 1369 1444 1521 1600 1681 1764 1849 1936 2025 2116 2209 2304 2401 2500 2601 2704 2809 2916 3025 3136 3249 3364 3481 3600 3721 3844 3969 4096 4225 4356 4489 4624 4761 4900 5041

then i used fitting tool network. with matrix rows. training is 70% validation is 15% and testing is 15% too. number of hidden neurons is 2. then in command lines i wrote this :

    purelin(net.LW{2}*tansig(net.IW{1}*inputTest+net.b{1})+net.b{2})
where inputTest is 3 the result of this command is 16. but as i know it's not correct. it should be about 9. other informations :

my net.b[1] is : -1.16610230053776 1.16667147712026

my net.b[2] is : 51.3266249426358

and net.IW(1) is : 0.344272596370387 0.344111217766824

net.LW(2) is : 31.7635369693519	-31.8082184881063

i think i shared all information for creating some network like me. you can do it yourself. but if it's not complete please aware me. thank you