clc
clear
function x = w(u, a, b, c, d)
  x = zeros(4);
  v = zeros(size(a, 1), a);
  l = size(u, 2);
  for i = 1:l
    x(i) = c * v + d * u(i);
    v = a * v + b * u(i);
  end
endfunction

h = 0.1;
t = 0:h:%pi;
u = ones(t);
x = w(sin(t), 1, h, 1, 0);
q = w(sin(t), -1/h, 0, 0, -1);
plot(t, q', t, cos(t))
