function [f,v] = dlqrdouble(a,b,q,r,tol,maxit) % %DLQRDOUBLE Discrete linear quadratic regulator solution % [f,v] = dlqrdouble(a,b,q,r) solves the Riccati equation % associated with the real discrete time optimal linear regulator % problem of the form % % min sum {x'qx + u'ru} % st x(t+1) = ax(t) + bu(t) % % Returned are the matrices f and v such that the optimal decision rule % is -fx and the value function is x'vx. tol and maxit are optional % parameters. If they both are not inputted then they are given % default values. See the m-file doubler.m for a description of % tol and maxit. % % ALGORITHM: Doubling algorithm % REFERENCES: B.D.O Anderson (1978) % WRITTEN BY: Evan W. Anderson Dec 1, 1994 % DOCUMENTATION MODIFIED: Dec 29, 1998 if nargin < 6, tol = 1e-15; maxit = 1e4; end [v,info] = doubler(a,b*(r\b'),q,tol,maxit); f = (b'*v*b + r)\b'*v*a;