%
%  Name:   peakpicking
%
%  Usage:  peakpicking
%
%  This m-file allows the user to 'slice' FRFs 
%  so an estimate of the frequencies and mode shapes can 
%  determined
% 

%  Version SWD970402
%
%  Author(s): Phillip Cornwell, cornwell@lanl.gov
%	modified by Scott W. Doebling, doebling@lanl.gov
%
%  Institution: Los Alamos National Laboratory,
%               ESA-EA
%
%  Copyright (c) 1996-1997, The Regents of the University
%       of California. (See top level of code for
%       full copyright statement.)
%
%   

   onHndlVector=handact(onHndlVector,hndlMatrix,2);
   
%  Turn off the 'keep modes' button until needed

   set(onHndlVector(15),'visible','off')

%  Turn off 'View Modes'

   set(onHndlVector(11),'visible','off')
       
%  Turn off 'Clear Modes' if no modes exist

   if exist('Phi') ~= 1, Phi=[]; end

%
%  define initial parameters
%
  
   iresp=1;
   iref=1;
   iylog = 1;
   iyscale = 1;



    nds = 1;
	assignG


	nn=1;
	mm=1;

   f1_t=cf;
   fmin=cf-sp/2;
   fmax=cf+sp/2;
   df=sp/(nlines-1);
   freq=fmin:df:fmax;
   numbins=(fmax-fmin)/df;
  

  fminm = fmin;
  fmaxm = fmax;
%
%  Define the axes for plottools
%

   haxes = onHndlVector(14);
   hallaxes = haxes;
   hlegax = [];
%
%  Make the Initial Plot
%

     
   lnst = ['- ';'- '];
   lnco = ['y';'r'];
	set(hplttl(11),'string','Data Line | Cursor')

	set(hplttl(14),'value',iyscale)
	set(hplttl(15),'value',iylog)
	eval(get(hplttl(16),'call'))
   
   
%
%  Set the variables for Plottools
%

	flim = get(haxes(1),'xlim');
	ylim = get(haxes(1),'ylim');


	set(hplttl(3),'string',num2str(flim(1)))
	set(hplttl(5),'string',num2str(flim(2)))
	set(hplttl(7),'string',num2str(ylim(1)))
	set(hplttl(9),'string',num2str(ylim(2)))

	yminm = ylim(1);
     ymaxm = ylim(2);

%  Slider parameters

set(onHndlVector(2),'max',fmax);
set(onHndlVector(2),'min',fmin);
set(onHndlVector(2),'userdata',freq);
set(onHndlVector(2),'sliderstep',[df/(fmax - fmin) 0.1]);

%
%  Draw the initial cursor 
%

[f1,onHndlVector(16:17)] = slidfreq(f1_t,onHndlVector(2),...
   onHndlVector(16:17),onHndlVector(14),ymaxm,yminm,lnst(2,:),lnco(2,:));

%
%  Set slider and text box values

set(onHndlVector(4),'string',num2str(f1))
set(onHndlVector(2),'value',f1);

%
%  Set hslider so that plottool can properly set frequency slider limits
%

hslider = onHndlVector(2);


