% Measures the minimum execution time of direct Carleman Bilinearization of
% filters + loudspeaker A

clear

P=4;        % Expansion order
rep=5;      % Number of repetitions for greater precision of execution
            % time measurement

arq='mCB_AfiltA_P4';  % Ouput file


% Numerical model
[f,g,h,x]=dloudAfiltA_num;      % Regenerate model to be sure


warning('off','cbvk:carlbidir');
warning('off','cbvk:mtred');


% ----------------------------------------------------
% Taylor expansion


x0=zeros(1,length(f));
F1 = mtred(f,x,x0,P);
G1 = mtred(g,x,x0,P-1);


%----------------------------------------------------
% Carleman Bilinearization

dt=zeros(1,rep);

for r=1:rep
  tic
  [F,G,b] = carlbidir(F1,G1,P);
  clear F G b
  dt(r)=toc;
  fprintf('%g\n ', dt(r));
end

min(dt)
%save(arq,'dt');
warning('on','cbvk:mtred');
warning('on','cbvk:carlbidir');



