function [error] = getError(esn, freq, plotGraphs)
%UNTITLED1 Summary of this function goes here
%  Detailed explanation goes here

%plotGraphs = false;

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

teacher = sineGenerator(1:nSeqLength, 500, freq) / 2;

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

output = sineGenerator(1:nTestSeqLength, 500, freq) / 2;


if (plotGraphs)
    figure(1);
    plot(teacher);
end

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

% test run
[nos2 ir error esn] = runNetworkWF(nTestSeqLength, output, 200, esn);
if (plotGraphs)
    figure(3);
    plot([nos2' output']);
end


