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: fuselageSetAeroelasticity.m
    path of file: ./repos/LADAC/aerodynamics/fuselage
    
    the code of the file until where you have to start completion: function fuselage = fuselageSetAeroelasticity( fuselage, structure, is_modal )
% fuselageSetAeroelasticity set aeroelasticity struct in fuselage struct
%   For aeroelastic simulations the structure node positions must be
%   converted into aerodynamic node positions and vice versa. Therefore,
%   transformation matrices are computed in this function that map from
%   structure points to aerodynamic points and vice versa.
%   First, the nodes are assigned to each other (assumes that structure
%   geometry and aerodynamic geometry match). Then, coefficients for linear
%   interpolations are computed and stored inside the matrices.

    
function fuselage = fuselageSetAeroelasticity( fuselage, structure, is_modal )
% fuselageSetAeroelasticity set aeroelasticity struct in fuselage struct
%   For aeroelastic simulations the structure node positions must be
%   converted into aerodynamic node positions and vice versa. Therefore,
%   transformation matrices are computed in this function that map from
%   structure points to aerodynamic points and vice versa.
%   First, the nodes are assigned to each other (assumes that structure
%   geometry and aerodynamic geometry match). Then, coefficients for linear
%   interpolations are computed and stored inside the matrices.
%   Note that the structure state is usually expressed in modal
%   coordinates to reduce the order of states. That is why, an additional
%   transformation is performed.
% 
% Syntax:
%   fuselage = fuselageSetAeroelasticity( fuselage, structure, is_modal )
% 
% Inputs:
%   fuselage        fuselage struct (see fuselageInit)
%   structure     	a structure struct (see structureCreateFromNastran)
%   is_modal        logical if the structure is based on modal coordinates
%                   (should be true)
% 
% Outputs:
%   fuselage        fuselage struct (see fuselageInit)
% 
% See also:
%   fuselageInit, structureCreateFromNastran, fuselageAssignToStructure
% 

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

% compute relative positions to fuselage center line (xi)
segment_length = vecnorm( diff( fuselage.geometry.border_pos, 1, 2 ), 2, 1 );
cntrl_shift = vecnorm( diff( fuselage.geometry.cntrl_pos - fuselage.geometry.border_pos(:,1:end