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: spm_dtf2gew.m
    path of file: ./repos/bspm/thirdparty/spm12/toolbox/spectral
    
    the code of the file until where you have to start completion: function [gew,pve] = spm_dtf2gew(dtf,C)
% Converts directed transfer function to Geweke Granger causality
% FORMAT [gew,pve] = spm_csd2gew(dtf,C)
%
% dtf  (N,n,n)   - (unnormalised) directed or modulation functions

    
function [gew,pve] = spm_dtf2gew(dtf,C)
% Converts directed transfer function to Geweke Granger causality
% FORMAT [gew,pve] = spm_csd2gew(dtf,C)
%
% dtf  (N,n,n)   - (unnormalised) directed or modulation functions
% C              - optional noise (fluctation) covariance matrix C(n,n)
%                - or cross spectral density C(N,n,n)
%                - or spectral power C(N,n)
%
% gwe  (N,n,n)   - Geweke's frequency domain Granger causality
% pve  (N,n,n)   - proportion of variance explained
%
% See also:
%  spm_ccf2csd.m, spm_ccf2mar, spm_csd2ccf.m, spm_csd2mar.m, spm_mar2csd.m,
%  spm_csd2coh.m, spm_dcm_mtf.m, spm_Q.m, spm_mar.m and spm_mar_spectral.m
%
%__________________________________________________________________________
% Copyright (C) 2014 Wellcome Trust Centre for Neuroimaging

% Karl Friston
% $Id: spm_dtf2gew.m 6481 2015-06-16 17:01:47Z karl $


% preliminaries
%--------------------------------------------------------------------------
n  = size(dtf,2);
nw = size(dtf,1);

%  spectral density of fluctuations
%--------------------------------------------------------------------------
c     = zeros(nw,n,n);
if nargin < 2;
    C = eye(n,n);
end