cnn_setenv;
mCNN.TemGroup = 'temlib_diff';

length = 40;

stick = zeros(40,3);
stick(:,2) = 2.*exp(.2*(-(1:length)+0.5))-1;

input = zeros(size(stick));
mCNN.INPUT1 = input;
init_state = stick;
mCNN.STATE = 1.*stick; %init_state;
mCNN.Boundary = 2; % [-1 ... 1] --> const, 2 --> zeroflux, 3 --> periodic
mCNN.TimeStep = 0.1;
mCNN.IterNum = 1;
loadtem('HEAT');

% and plot the results:
figure;
subplot(1, 3, 1);
plot(input(:,2));
title('input', 'FontSize', 12, 'FontWeight', 'bold');
ylim([-1 1])
subplot(1, 3, 2);
plot(init_state(:,2)); %init_state);
ylim([-1 1])
title('initial state', 'FontSize', 12, 'FontWeight', 'bold');
subplot(1, 3, 3);
for ind = 1:100
    runtem; % run the simulator
    plot(mCNN.OUTPUT(:,2));
    ylim([-1 1])
    drawnow
    title(['output i=', num2str(ind)], 'FontSize', 12, 'FontWeight', 'bold');
    pause(0.05)
end

