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: wingSetUnstAeroState.m
    path of file: ./repos/LADAC/aerodynamics/vlm_wing/state
    
    the code of the file until where you have to start completion: function wing = wingSetUnstAeroState( wing ) %#codegen
%wingSetUnstAeroState sets the wing.state.aero.circulation.unsteady struct
% of a wing struct.
%
% Inputs:
% 	wing           	wing struct, see wingCreate
% 
% Outputs:
% 	wing           	wing struct, see wingCreate
% 
% Literature:
%   [1] Leishman, J. G., & Nguyen, K. Q. (1990). State-space representation
%       of unsteady airfoil behavior. AIAA journal, 28(5), 836-844.
%   [2] Leishman, J. (1989, April). State-space model for unsteady airfoil
%       behavior and dynamic stall. In 30th Structures, Structural Dynamic
%       and Materials Conference (p. 1319).
%   [3] Leishman, J. G., & Beddoes, T. S. (1989). A Semi?Empirical model for
%       dynamic stall. Journal of the American Helicopter society, 34(3),
%       3-17.
%   [4] Hansen, M. H., Gaunaa, M., & Madsen, H. A. (2004). A Beddoes-
%       Leishman type dynamic stall model in state-space and indicial
%       formulations.
% 
% See also: wingSetCirculationUnsteady, wingCreateState, wingCreate
% 

% Disclamer:
%   SPDX-License-Identifier: GPL-3.0-only
% 
%   Copyright (C) 2020-2022 Yannic Beyer
%   Copyright (C) 2022 TU Braunschweig, Institute of Flight Guidance

    
function wing = wingSetUnstAeroState( wing ) %#codegen
%wingSetUnstAeroState sets the wing.state.aero.circulation.unsteady struct
% of a wing struct.
%
% Inputs:
% 	wing           	wing struct, see wingCreate
% 
% Outputs:
% 	wing           	wing struct, see wingCreate
% 
% Literature:
%   [1] Leishman, J. G., & Nguyen, K. Q. (1990). State-space representation
%       of unsteady airfoil behavior. AIAA journal, 28(5), 836-844.
%   [2] Leishman, J. (1989, April). State-space model for unsteady airfoil
%       behavior and dynamic stall. In 30th Structures, Structural Dynamic
%       and Materials Conference (p. 1319).
%   [3] Leishman, J. G., & Beddoes, T. S. (1989). A Semi?Empirical model for
%       dynamic stall. Journal of the American Helicopter society, 34(3),
%       3-17.
%   [4] Hansen, M. H., Gaunaa, M., & Madsen, H. A. (2004). A Beddoes-
%       Leishman type dynamic stall model in state-space and indicial
%       formulations.
% 
% See also: wingSetCirculationUnsteady, wingCreateState, wingCreate
% 

% Disclamer:
%   SPDX-License-Identifier: GPL-3.0-only
% 
%   Copyright (C) 2020-2022 Yannic Beyer
%   Copyright (C) 2022 TU Braunschweig, Institute of Flight Guidance
% *************************************************************************

% init
alpha_inf_0 = zeros( 1, wing.n_panel );

% use raw inflow in the first step and take into account downwash
% afterwards
cos_sweep = cos(wing.interim_results.sweep);
abs_V_i = vecnorm( wing.state.aero.local_inflow.V_25, 2 ) .* cos_sweep;
c_i = wing.state.geometry.ctrl_pt.c ./ cos_sweep;

% dimensionless pitch rate [1], Nomenclature and Eq. between (18) and (19)
q = wing.state.aero.circulation.q;

% to do: explain why aerodynamic center is at 0.25c
x_ac = 0.25 * ones( 1, wing.n_panel );

alpha_eff = wing.state.aero.circulation.alpha_eff;

switch wing.config.airfoil_method
    case 'analytic'

        % get coefficients of analytic functions for different Mach numbers
        fcl = airfoilAnalytic0515Ma( wing.airfoil.analytic.wcl, wing.state.aero.circulation.Ma );
        fcd = airfoilAnalytic0515Ma( wing.airfoil.analytic.wcd, wing.state.aero.circulation.Ma );
        fcm = airfoilAnalytic0515Ma( wing.airfoil.analytic.wcm, wing.state.aero.circulation.Ma );
        
        if ~wing.config.is_stall
            x_ac(:) = airfoilAnalyticBlXac( fcm );
        end