function [A,B,C,D,K,X0] = motor(par,ts,aux)
% This m-file describes the dc-motor with time-constant t (= par)
% and known static gain G. The sampling interval is ts. The conversion
% to a sampled model is inhibited if ts is entered as a negative number.
% This is to allow for desirable features in the 'present'and 'eta2ss'
% commands.

t = par;
G=aux(1); 

A=[0 1;0 -1/t];
B=[0;G/t];
C=eye(2);
D=[0;0];
K=zeros(2,2);
X0=[0;0];
if ts>0 % Sample the model with sampling interval ts
s = expm([[A B]*ts; zeros(1,3)]);
A = s(1:2,1:2);
B = s(1:2,3);
end
