function [nos ir output esn] = simpleSine()
%simpleSine Testing script
%  Detailed explanation goes here


nTestSeqLength = 1000;
nSeqLength = 500;
%output = sin((1:nSeqLength) / 4) / 2;
%output = output ;

output = sineGenerator(1:nSeqLength, 500, 25) / 2;
%output = modulatedSineGenerator(1:nSeqLength, 500, 30, 40) / 2;
%output = zeros(nSeqLength);

teacher = output(1:nSeqLength);

esn = create_esn(25, 1, 20, 0.8);

esn = scaling(esn, 1.5);

%max(abs(eig(esn.resWeights)))

%initial run

%[nos ir esn] = runNetwork(100, esn);
figure(1);
plot(teacher);

%figure(1);
%plot(1:50, ir(1:5, 1:50));

% train network
[nos ir esn] = train(teacher, esn);
figure(2);
%plot(1:length(teacher), ir(1:10, 1:length(teacher)));

interval = 1:200;

subplot(2, 3, 1);
plot(ir(1, interval));
subplot(2, 3, 2);
plot(ir(2, interval));
subplot(2, 3, 3);
plot(ir(3, interval));
subplot(2, 3, 4);
plot(ir(4, interval));
subplot(2, 3, 5);
plot(ir(5, interval));
subplot(2, 3, 6);
plot(ir(6, interval));

% test run

[nos2 ir esn] = runNetwork(nTestSeqLength, esn);
figure(3);
wholeSeqLength = nSeqLength + nTestSeqLength;
plot(1:wholeSeqLength, [nos nos2]);
plot(nos2);

[nos ir error_train esn] = getMSEtrain(500, teacher, 400, esn);
[nos ir error_test esn] = getMSEtest(500, teacher, 400, esn);

error_train
error_test

% esn = create_esn(20, 1, 20, 0.88);
% 
% esn = scaling(esn, 1.5);
% 
% [nos2 ir esn] = runNetwork(nTestSeqLength, esn);
% figure(3);
% plot(nos2);


%--------------------------------
% [nos1 ir esn] = train(teacher, esn);
% 
% esn.x = rand(1, 20)' - 0.5;
% [nos1 ir esn] = train(teacher, esn);
% esn.x = rand(1, 20)' - 0.5;
% [nos2 ir esn] = train(teacher, esn);
% 
% 
% figure(3);
% %subplot(1, 2, 1);
% 
% plot([nos1'  nos2']);
%subplot(1, 2, 2);

%plot(nos2);


% esn = create_esn(20, 1, 20, 0.9880);
% esn = scaling(esn, 1.5);
% 
% % train network
% [nos3 ir esn] = train(teacher, esn);
% 
% % test run
% figure(3);
% 
% subplot(1, 2, 1);
% plot(nos);
% 
% subplot(1, 2, 2);
% plot(nos3);


%--------------------------------

%starting from another random state
%esn.x = rand(1, size(esn.x))' - 0.5;
%[nos ir esn] = runNetwork(100, esn);

%figure(2);
%plot(1:100, nos(1:100));


%plot(1:nSeqLength, output);

%[nos ir esn] = processInput(nSeqLength, esn);
%[nos ir esn] = train(output(1:300), esn);
%plot(1:nSeqLength - 50, nos);


%[nos2 ir esn] = processInput(200, esn);
%plot(1:nSeqLength + 150, [nos nos2]);




