Note that this reference documentation is identical to the help that is displayed in MATLAB when you type “help residualvariance”.

  RESIDUALVARIANCE scan with a single dipole and computes the RV
  at each grid location.
 
  Use as
    [dipout] = residualvariance(dip, grad, headmodel, dat, ...)