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: leadfield_simbio.m
    path of file: ./repos/fecgsyn/subfunctions/data-generation/libs/fieldtrip/forward/private
    
    the code of the file until where you have to start completion: function [lf] = leadfield_simbio(pos, vol)

% leadfield_simbio leadfields for a set of dipoles
%
% [lf] = leadfield_simbio(pos, vol);
%
% with input arguments
%   pos     a matrix of dipole positions
%           there can be 'deep electrodes' too!
%   vol     contains a FE volume conductor (output of ft_prepare_vol_sens)
%
% the output lf is the leadfield matrix of dimensions m (rows) x n*3 (cols)

% copyright (c) 2012, Johannes Vorwerk

try   
    lf = zeros(3*size(pos,1),size(vol.transfer,1));

    
function [lf] = leadfield_simbio(pos, vol)

% leadfield_simbio leadfields for a set of dipoles
%
% [lf] = leadfield_simbio(pos, vol);
%
% with input arguments
%   pos     a matrix of dipole positions
%           there can be 'deep electrodes' too!
%   vol     contains a FE volume conductor (output of ft_prepare_vol_sens)
%
% the output lf is the leadfield matrix of dimensions m (rows) x n*3 (cols)

% copyright (c) 2012, Johannes Vorwerk

try   
    lf = zeros(3*size(pos,1),size(vol.transfer,1));
    dir = diag([1,1,1]);
    for i=1:size(pos,1)
        locpos = repmat(pos(i,:),3,1);
        rhs = sb_rhs_venant(locpos,dir,vol);
        lf((3*(i-1)+1):(3*(i-1)+3),:) = (vol.transfer * rhs)';
    end