function iduiqs
%IDUIQS Quickstart operation for ident.
%      For the current Estimation data set, the impulse response(s)
%      are calculated using correlation analysis. Then
%      the frequency response(s) are calculated using spectral 
%      analysis. The delay in the different channels are
%      estimated by picking the first value where the impulse
%      response estimate exceeds 0.5*the estimated standard
%      deviation. Then a fourth order ARX-model is computed
%      with these delays. The step responses, the frequency 
%      responses and a compare view are opened for the resulting
%      models

%	L. Ljung 4-4-94
%	Copyright (c) 1986-95 by the MathWorks, Inc.
%	$Revision: 1.4 $  $Date: 1995/05/10 21:36:59 $

global XIDplotw
[dum,info]=iduigetd('e');
Ncap=eval(info(4,:));
nuseq=eval(['[',info(7,:),']']);
nyseq=eval(['[',info(6,:),']']);
nu1=nuseq(1);ny1=nyseq(1);
[ny,nu]=iduiiono('old',info,'dat');
chan_flag=0;
if nu>0
   if nu1>1|ny1>1,chan_flag=1;end
else
   if ny1>1,chan_flag=1;end
end
if nu>0
  IR=iduinpar('cra');
  for ky=1:ny
   for ku=1:nu
     kdum=find(IR(3:length(IR),(ky-1)*nu+ku)>IR(2)/2.58/2);
     if isempty(kdum)
        nk(ky,ku)=0;
     else
        nk(ky,ku)=kdum(1)-1;
     end
   end
  end
  set(XIDplotw(5,2),'value',1),iduipw(5);
  if chan_flag,iduiiono('update',ny1,nu1,5,1);end
end
iduinpar('spa');
if nu>0,
  wino=2;
else 
  wino=7;
end
set(XIDplotw(wino,2),'value',1),iduipw(wino);
if chan_flag,iduiiono('update',ny1,nu1,wino,1);end
iduistat('Computing a 4th order ARX model...');
iduiarx('estimate',[4*ones(ny,ny),4*ones(ny,nu),nk],'arx_qs');
set(XIDplotw(3,2),'value',1),iduipw(3);
if ny1>1,iduiiono('update',ny1,nu1,3,1);end
if Ncap>19*ny+30*(nu+1)
  iduistat('Computing a default order state space model using N4SID...');
  iduiss('qsestimate');
else
  iduistat('Too few data points for default order N4SID model.')
end
