%
% example 5.6 - ann for settling velocity data
%
xx = 250:250:8000;
load vs.dat
%
% train an ann (may need several starts to get
%   stable convergence)
%
u = ( xx - 4000 ) / 4000;
d = ( vs + 2 ) / 12;
eta = 0.2;
alpha = 0.8;
nnode = 5;
[ y, wij, wjk ] = nntrain( u, d, nnode, eta, alpha );
wij
wjk
%
% plot data
%
figure
plot( xx, vs, 'o' );
axis( [ 0 8000 0 8 ] );
set( gca, 'fontsize', 20 );
xlabel( 'Suspended Solids in mg/l' );
ylabel( 'Velocity in m/h' );
hold on;
plot( 0, 8, 'o' );
%
% evaluate net and plot the fit
%
xx = 0:250:8000;
u = ( xx - 4000 ) / 4000;
y = annnet( u, wij, wjk );
fvs = 12 * y - 2;
plot( xx, fvs, '-' );
hold off;
%
print -f2 -deps2 ex5-5.eps
%

