% 
% Generate velocity error data plot

function [ velErr, statistics ] = ...
    plotVelError ( posData, key, parameters, segments, ctrl, ...
                   abscissa, statistics ) 


if ~ctrl.plotVel
  meanVel = [0,0,0];
  stdVel = [0,0,0];
  velErr = 0; 
  disp('Skipping velocity plots');
  return; 
end


% All the velocity is velocity error, because the antenna is
% static. 
velErr = posData (:,key.VLAT:key.VHGT);

statistics = computeStatistics( velErr*1000, segments, 'velocity', ...
                                statistics );
meanVel = statistics.meanVelErr;
stdVel = statistics.stdVelErr; 


for verticalView = 0:1
  for autoScale = 0:1
    plotPVFig ( velErr, meanVel, stdVel, 'mm/s', 'Velocity', 'm/s', ...
                'Velerr.png', segments, ctrl, abscissa, verticalView, ...
                autoScale, parameters.velLimitMetersPerSecond);
  end
end

end
