% Sweep OMCL (OMC length) and generate plots.
%
% [xPos, sigDC, fDC] = sweepOMCL(Nsweep)
% see sweepDC for information about the parameters

function [xPos, sigDC, fDC] = sweepOMCL(Nsweep)

  % prepare some variables
  sweepSetup

  % adding this to sweepSetup causes matlab to crash, so do it here
  nDC = [nOMC(1); nAS([1 4])];
  nAC = [nOMC(2:3); nAS([2:3 5:6])];

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % DARM sweep
  pos = zeros(opt.Noptic, 1);
  pos(nOMCb) = 1e-7;
  
  [xPos, sigDC, fDC] = sweepDC(opt, -pos, pos, Nsweep);

  subplot(2, 1, 1)
  plot(xPos(nOMCb, :), sigDC(nDC, :))
  legend(prbNames(nDC))
  title('OMCL sweep: DC signals')
  grid on

  subplot(2, 1, 2)
  plot(xPos(nOMCb, :), sigDC(nAC, :))
  legend(prbNames(nAC))
  title('OMCL sweep: demod signals')
  grid on
