function [A,B,Q,U,R,uy,upi,C] = Svensson(a1,b1,b2,coeffinfl,stdinfl,stdy, ...
                                         outputweight,rweight,drweight);
%  Svensson    Prepares the matrices needed in solving the svensson model
%
%
%
%   Usage: [A,B,Q,U,R,uy,upi,C] = SvenssonSS(a1,b1,b2,coeffinfl,stdinfl,stdy, ...
%                                            outputweight,rweight,drweight);
%
%  Input:  a1, b1,b2, coeffinfl are defined as in the program puzzle\svensson
%          stdinfl and stdy are the standard deviations  of the cost push and AD shock
%          outputweight, rweight and drweight are the coefficient on output,
%          i (nominal interest rate) and di in the loss function
%          (coeff on infl normalized to one)
%
%  Output: as in MonPol31. C*C' is the VCV matrix
%
%  Paolo Giordani, January 2002
%------------------------------------------------------------------------------

n1 = 3;   %state variables: yg(t), pi(t), i(t-1), allows interest rate smoothing
n2 = 0;
                 %State space representation for (in order) output and inflation
A = eye(n1+n2);
A(1,1) = b1; A(1,2)= b2;
A(2,1) = a1;
A(3,3) = 0;

B = [-b2;0;1];

upi = [0;1;0];          %price shock
uy  = [1;0;0];          %positive demand shock

Q = [outputweight,0,0;0,1,0;0,0,drweight];
R = rweight+drweight;
U = zeros(n1+n2,1);
U(3,1) = -2*drweight;
C = zeros(n1+n2,n1);
C(1,1) = stdinfl;
C(2,2) = stdy;
%----------------------------------------------------------------------------
