This is a poor example: N = 10 is not large enough to obtain robust practical solutions. With [I N ] =size(x) = [ 3 10 ], [O N ] = size(t) = [ 1 10], Ntst = round(0.15*N) = 2, Nval = Ntst =2, Ntrn = N-Nval-Ntst = 6, Ntrneq = Ntrn*O = 6 is the number of training equations.
With H hidden nodes, the number of unknown weights is Nw = (I+1)*H+(H+1)*O. A sufficient condition for a robust practical solution is Ntrneq >> Nw. However, Notice that, Ntrneq > Nw only when H <= Hub where Hub = -1+ceil( (Ntrneq-O) / (I+O+1)) = 0.
There is quite a bit more that I could say about this poor example. However, the main points are
1. I was able to run your code
2. Be careful of overfitting (H too large and/or N too small) with your real data set.
Hope this helps.
Thank you for formally accepting my answer