function [Y,U]=fun_clop_data(R)

A=[1.5 1;-0.7 0]; B=[2;-1.3]; K=[0.5;0.3];
D=[1 0];

Kp=0.2; Ti=7;

N=1000;
%randn('seed',0); rand('seed',0)   % Setting seeds in prbs1 function.
%R=prbs1(N,75,175);                % The reference signal

%randn('seed',0)
en=randn(N,1)*0.05;                % Innovations noise used.

x=[0;0]; z=0;                     % Initial states

for k=1:N
    y=D*x+en(k);                  % Measurement
    
    e=R(k)-y;                     % The PI controller
    u=Kp*e+z;
    z=z+Kp*e/Ti;
    
    Y(k,1)=y;                     % Soring data
    U(k,1)=u;
    
    x=A*x + B*u +K*en(k);         % Feed control, u_k, to the process
end