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: dtd_covariance_check_xps.m
    path of file: ./repos/md-dmri/methods/dtd_covariance
    
    the code of the file until where you have to start completion: function dtd_covariance_check_xps(xps, opt)
% function dtd_covariance_check_xps(xps)
% 
% checks that all required fields are found in the xps

if (nargin < 2), opt = []; end

mdm_xps_check(xps);

required_fields = {'n', 'bt'};

for c = 1:numel(required_fields)
    if (~isfield(xps, required_fields{c}))
        error('xps.%s not found', required_fields{c});
    end
end
    
% Check that the b-tensors produce an invertible matrix
opt = dtd_covariance_opt(opt);

tmp = warning('query'); warning off; % probe without throwing warning
[~,cond] = dtd_covariance_1d_data2fit(exp(-xps.bt * [1 1 1 0 0 0]' * 1e-9), xps, opt);
warning(tmp);

if (cond < opt.dtd_covariance.cond_limit)
    
    try

    
function dtd_covariance_check_xps(xps, opt)
% function dtd_covariance_check_xps(xps)
% 
% checks that all required fields are found in the xps

if (nargin < 2), opt = []; end

mdm_xps_check(xps);

required_fields = {'n', 'bt'};

for c = 1:numel(required_fields)
    if (~isfield(xps, required_fields{c}))
        error('xps.%s not found', required_fields{c});
    end
end
    
% Check that the b-tensors produce an invertible matrix
opt = dtd_covariance_opt(opt);

tmp = warning('query'); warning off; % probe without throwing warning
[~,cond] = dtd_covariance_1d_data2fit(exp(-xps.bt * [1 1 1 0 0 0]' * 1e-9), xps, opt);
warning(tmp);

if (cond < opt.dtd_covariance.cond_limit)
    
    try
        mdm_xps_info(xps, 'dtd_covariance', opt);
    catch
        disp('Unable to provide xps information');
    end