Home > matlab > AIM > SPShiftright.m

SPShiftright

PURPOSE ^

[y] = shiftright(x,n)

SYNOPSIS ^

function [y] = SPShiftright(x,n)

DESCRIPTION ^

 [y] = shiftright(x,n)

  Shift the rows of x to the right by n columns, leaving zeros in the
  first n columns.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [y] = SPShiftright(x,n)
0002 
0003 % [y] = shiftright(x,n)
0004 %
0005 %  Shift the rows of x to the right by n columns, leaving zeros in the
0006 %  first n columns.
0007 
0008 % Original author: Gary Anderson
0009 % Original file downloaded from:
0010 % http://www.federalreserve.gov/Pubs/oss/oss4/code.html
0011 % Adapted for Dynare by Dynare Team.
0012 %
0013 % This code is in the public domain and may be used freely.
0014 % However the authors would appreciate acknowledgement of the source by
0015 % citation of any of the following papers:
0016 %
0017 % Anderson, G. and Moore, G.
0018 % "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
0019 % Models."
0020 % Economics Letters, 17, 1985.
0021 %
0022 % Anderson, G.
0023 % "Solving Linear Rational Expectations Models: A Horse Race"
0024 % Computational Economics, 2008, vol. 31, issue 2, pages 95-113
0025 %
0026 % Anderson, G.
0027 % "A Reliable and Computationally Efficient Algorithm for Imposing the
0028 % Saddle Point Property in Dynamic Models"
0029 % Journal of Economic Dynamics and Control, 2010, vol. 34, issue 3,
0030 % pages 472-489
0031 
0032 [rows,cols] = size(x);
0033 
0034 left  = 1:cols-n;
0035 right = n+1:cols;
0036 
0037 y = zeros(rows,cols);
0038 y(:,right) = x(:,left);
0039 
0040 return

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005