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: pspm_resp_pp.m
    path of file: ./repos/PsPM/src
    
    the code of the file until where you have to start completion: function sts = pspm_resp_pp(fn, sr, channel, options)
% ● Description
%   pspm_resp_pp preprocesses raw respiration traces. The function detects
%   respiration cycles for bellows and cushion systems, computes respiration
%   period, amplitude and RFR, assigns these measures to the start of each
%   cycle and linearly interpolates these (expect rs = respiration time
%   stamps). Results are written to new channels in the same file
% ● Format
%   sts = pspm_resp_pp(fn, sr, channel, options)
% ● Arguments

    
function sts = pspm_resp_pp(fn, sr, channel, options)
% ● Description
%   pspm_resp_pp preprocesses raw respiration traces. The function detects
%   respiration cycles for bellows and cushion systems, computes respiration
%   period, amplitude and RFR, assigns these measures to the start of each
%   cycle and linearly interpolates these (expect rs = respiration time
%   stamps). Results are written to new channels in the same file
% ● Format
%   sts = pspm_resp_pp(fn, sr, channel, options)
% ● Arguments
%                 fn: data file name
%                 sr: sample rate for new interpolated channel
%            channel: number of respiration channel (optional, default:
%                     last respiration channel)
%   ┌────────options:
%   ├────.systemtype: ['bellows'(default) /'cushion']
%   ├──────.datatype: a cell array with any of 'rp', 'ra', 'rfr',
%   │                   'rs', 'all' (default)
%   ├───.diagnostics:
%   ├──────────.plot: 1 creates a respiratory cycle detection plot
%   └.channel_action: ['add'(default) /'replace']
%                     Defines whether the new channels should be added or the
%                     corresponding channel should be replaced.
% ● History
%   Introduced in PsPM 3.0
%   Written in 2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging)

%% Initialise
global settings
if isempty(settings)
  pspm_init;
end