function [a,b,c,d]=contth(ad,bd,cd,dd,T,flag)
%CONTTH	Is an auxiliary function for eta2ss and thss2th
%	[a,b,c,d] = contth(ad,bd,cd,dd,T,flag)

%	L. Ljung 10-2-1990
%	Copyright (c) 1986-95 by the MathWorks, Inc.
%	$Revision: 1.2 $  $Date: 1995/01/24 00:50:09 $

if flag
if exist('minreal'), eval('[ad,bd,cd,dd] = minreal(ad,bd,cd,dd);');
else, error('The command does not handle multioutput, continuous time ARX-models without the CONTROL SYSTEMS TOOLBOX. See contth.m!'),end
end
[m,n] = size(ad);
[m,nb] = size(bd);
s = real(logm([[ad bd]; zeros(nb,n) eye(nb)]))/T;
a = s(1:n,1:n);
b = s(1:n,n+1:n+nb);
c=cd;d=dd;
