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: planAnalysis.m
    path of file: ./repos/LADAC/control/PLAN
    
    the code of the file until where you have to start completion: function [ A, B, C, D, K ] = planAnalysis( states_dtPertub, ...
    controlInputsPertub, outputsPertub, pertubDelta, i )
%#codegen
%planAnalysis   computes the linearized state-space representation matrices
%   due to pertubation.
%
% Inputs:
%   states_dtPertub         pertubated time derivatives of the state vector
%   controlInputsPertub     pertubated control inputs vector
%   outputsPertub           pertubated output vector
%   pertubDelta             current pertubation value (scalar)
%   i                       current pertubation index (scalar)
%
% Output:

    
function [ A, B, C, D, K ] = planAnalysis( states_dtPertub, ...
    controlInputsPertub, outputsPertub, pertubDelta, i )
%#codegen
%planAnalysis   computes the linearized state-space representation matrices
%   due to pertubation.
%
% Inputs:
%   states_dtPertub         pertubated time derivatives of the state vector
%   controlInputsPertub     pertubated control inputs vector
%   outputsPertub           pertubated output vector
%   pertubDelta             current pertubation value (scalar)
%   i                       current pertubation index (scalar)
%
% Output:
%   A                       system matrix
%   B                       input matrix
%   C                       output matrix
%   D                       feedthrough matrix
%   K                       control gain matrix
%
% See also: planInput
% 

% Disclamer:
%   SPDX-License-Identifier: GPL-3.0-only
% 
%   Copyright (C) 2021 Alexander Kuzolap
%   Copyright (C) 2022 TU Braunschweig, Institute of Flight Guidance
% *************************************************************************

    %% Declare persistent variable
    persistent iMax iStatesMax;
    persistent states_dtDelayed ...
        controlInputsDelayed outputsDelayed;
    
    persistent A_per B_per C_per D_per K_per;
    
    %% Initialization
    % Get the signal sizes
    numStates = length( states_dtPertub );
    numCntrIn = length( controlInputsPertub );
    numOutputs = length( outputsPertub );
        
    A = zeros( numStates );
    B = zeros( numStates, numCntrIn );
    C = zeros( numOutputs, numStates );
    D = zeros( numOutputs, numCntrIn );
    K = zeros( numCntrIn, numStates );
    
    if isempty( iMax ) || isempty( iStatesMax )
        
        iStatesMax = numStates;
        iMax = iStatesMax + numCntrIn;
    end