echo on P = [0 1 2 3 4 5 6 7 8 9 10]; %Domain is dim x numpts T = [0 1 2 3 4 3 2 1 2 3 4]; %Range is dim x numpts net = newff(minmax(P),[5 1],{'tansig' 'purelin'}); %You don't need to change the minmax or what's in the curly braces. %The term: [5,1] refers to the number of nodes in hidden, output layer net.trainParam.epochs = 50; %How many times should we train? net = train(net,P,T); P1=linspace(0,10); %Get new domain data Y = sim(net,P1); %Get new outputs plot(P,T,'ro',P1,Y) fprintf('Touch any key to continue\n') pause %Try with fewer neurons: net = newff(minmax(P),[2 1],{'tansig' 'purelin'}); net=train(net,P,T); Y=sim(net,P1); plot(P,T,'ro',P1,Y); echo off