%neural.m
%written 11/20/1998 by Oguz Yetkin for Physics 691
%defines a neural net, iterates it, etc.  This file is
%here for the purposes of playing around with recurrent neural nets
%
%needs: gauss.m niterate.m
%for now, only deals with square matrices (n=m)
%
rand('state',sum(100*clock))

n=32;
m=n;
s=1;


gaussnum=32;	%how wide to make gaussian distrib

wts=zeros(n);
x=ones(1,n);	%output vector
y=ones(1,n);

for i=1:n
	for j=1:n
		wts(i,j)=gauss(gaussnum)/sqrt(n);
	end
end

%run the above, then, to generate 100 timepoints, try
% test=zeros(1,100);for i=1:100 x= niterate(wts, x, s);test(i)=x(1);end

%or, for a full taste of stuff, do:
%neural;test=zeros(1,100);for i=1:100 x= niterate(wts, x, s);test(i)=x(1);end;plot(test);

%fancier, graphical version
%f1=figure;f2=figure;f3=figure;
%neural;n1=zeros(1,100);n2=n1;n3=n1;for i=1:100 
%x= niterate(wts, x, s);n1(i)=x(1);n2(i)=x(2);n3(i)=x(3);end;
%figure(f1);plot(n1);figure(f2);plot(n2);figure(f3);plot(n3);

