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: arap_energy.m
    path of file: ./repos/gptoolbox/mesh
    
    the code of the file until where you have to start completion: function [E,ER] = arap_energy(V,F,U,varargin)
  % ARAP_ENERGY This function is meant as a very human readable groundtruth for
  % evaluating ARAP energies.
  % For faster energy computation see `arap_gradient.m`
  %
  % Inputs:
  %    V  #V by dim list of mesh vertex rest positions
  %    F  #F by simplex list of element indices into V
  %    U  #V by dim list of deformed vertex positions
  %   Optional:
  %     'Energy' followed by 'spokes','spokes-and-rims', or 'elements'
  %       {'elements' or 'spokes-and-rims'} for tets or triangles respectively.
  % Outputs:
  %    E  scalar energy
  %    ER  #R list of "per-rotation" energy contributions
  %
  %
  % Known issues:
  % If E_G is the energy returned by arap_gradient, then
  % 'spokes-and-rims' energy E = 3 E_G 
  % 'spokes' energy E = 2 E_G 
  % 'elements' energy E = E_G
  %


    
function [E,ER] = arap_energy(V,F,U,varargin)
  % ARAP_ENERGY This function is meant as a very human readable groundtruth for
  % evaluating ARAP energies.
  % For faster energy computation see `arap_gradient.m`
  %
  % Inputs:
  %    V  #V by dim list of mesh vertex rest positions
  %    F  #F by simplex list of element indices into V
  %    U  #V by dim list of deformed vertex positions
  %   Optional:
  %     'Energy' followed by 'spokes','spokes-and-rims', or 'elements'
  %       {'elements' or 'spokes-and-rims'} for tets or triangles respectively.
  % Outputs:
  %    E  scalar energy
  %    ER  #R list of "per-rotation" energy contributions
  %
  %
  % Known issues:
  % If E_G is the energy returned by arap_gradient, then
  % 'spokes-and-rims' energy E = 3 E_G 
  % 'spokes' energy E = 2 E_G 
  % 'elements' energy E = E_G
  %


  switch size(F,2)
  case 4
    energy = 'elements';
  case 3
    energy = 'spokes-and-rims';
  end