x = [];
y0 = [];
y1 = [];

w = 2/5;
T = 64;
n = [1:T];

b0 = -ones(1, T/2);
b1 = ones(1, T/2);

square = [b1 b0 b0 b0 b1 b0 b1 b1];

delete('out0.dat');
delete('out1.dat');

while 1
	%out = square(1 + mod(n-1, length(square)));
	out = cos(pi*w * (n-1));
	out = out(:);

	save -ascii in0.dat out;
	save -ascii in1.dat out;

	while !exist('out0.dat', 'file') || !exist('out1.dat', 'file')
		pause(0.1);
	end;

	x = [x n];
	y0 = [y0 load('out0.dat')'];
	y1 = [y1 load('out1.dat')'];

	%if n(1) >= N
		%x = [x((T+1):N) n];
	%end;
	%y = [y((T+1):N) load('out0.dat')'];

	len = length(x);
	last = [(len-256):len];
	last(last<=0) = [];

	figure(1);
	title('y0');
	%plot(x(last), y0(last));
	figure(2);
	title('y1');
	%plot(x(last), y1(last));

	n = n + T;


	delete('out0.dat');
	delete('out1.dat');
end;
