% Here input x and targets t define a simple function that you can plot: x = [0 1 2 3 4 5 6 7 8]; t = [0 0.84 0.91 0.14 -0.77 -0.96 -0.28 0.66 0.99]; plot(x,t,'o') % Here feedforwardnet creates a two-layer feed-forward network. The network has one hidden layer with ten neurons. net = feedforwardnet(10); net = configure(net,x,t); % Selection of the optimal weights % The network is trained and then resimulated. net = train(net,x,t); y2 = net(x); plot(x,t,'o',x,y2,'*') perf = perform(net,t,y2) squar_err = (t - y2)*(t - y2)'/length(t) % squared error