You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: kronApprox.m
    path of file: ./repos/IRtools/Extra/prblur_tools/@psfMatrix
    
    the code of the file until where you have to start completion: function G = kronApprox(K, g, Rtol)
%
%  Compute a Kronecker product approximation of a psfMatrix, K:
%           K \approx G = \sum [ A{i} (x) B{i} ]
%
%  On Entry: 
%           K - psfMatrix object
%           g - the right hand side vector (blurred image)
%        Rtol - truncation tolerance for the number of terms in the
%               sum of Kronecker product approximation
%                OR
%                positive integer specifying the number of terms in the
%                approximation.
%
%  On Exit:
%      G -  kronMatrix object (See help kronMatrix for more inforation.)
%

%  L. Perrone, 5/2003

% Modifications:
% 6/2003, J. Nagy
%         Combined some codes from original kronMatrix.m with
%         original kronApprox.
%

switch nargin

    
function G = kronApprox(K, g, Rtol)
%
%  Compute a Kronecker product approximation of a psfMatrix, K:
%           K \approx G = \sum [ A{i} (x) B{i} ]
%
%  On Entry: 
%           K - psfMatrix object
%           g - the right hand side vector (blurred image)
%        Rtol - truncation tolerance for the number of terms in the
%               sum of Kronecker product approximation
%                OR
%                positive integer specifying the number of terms in the
%                approximation.
%
%  On Exit:
%      G -  kronMatrix object (See help kronMatrix for more inforation.)
%

%  L. Perrone, 5/2003

% Modifications:
% 6/2003, J. Nagy
%         Combined some codes from original kronMatrix.m with
%         original kronApprox.
%

switch nargin
case 1
  g = [];
  Rtol = [];
case 2
  Rtol = [];
end