%-- 03.05.2024 14:10 --%
clc
systf = tf(5,[1 1 10])
sys   = ss(systf) ;
format compact
sys(systf)
ss(systf)
clc
figure
subplot(221)
plot(t,y)
grid on;
a = axis ;
axis([a(1) max(t) a(3) a(4)])
title('Unforced response')
xlabel('Zeit t')
ylabel('y (t)')
subplot(223)
plot(t,x(:,1),'r-',t,x(:,2),'g--')
grid on;
a = axis ;
axis([a(1) max(t) a(3) a(4)])
title('')
xlabel('Zeit t')
ylabel('x1, x2')
legend('x1','x2')
subplot(122)
plot(x(:,1),x(:,2))
grid on;
title('State trajectories')
xlabel('x1')
ylabel('x2')
clc
[y,t,x] = initial (sys,'r-',[4 -1],12) ;    % unforced response
pause
figure
subplot(221)
plot(t,y)
grid on;
a = axis ;
axis([a(1) max(t) a(3) a(4)])
title('Unforced response')
xlabel('Zeit t')
ylabel('y (t)')
subplot(223)
plot(t,x(:,1),'r-',t,x(:,2),'g--')
grid on;
a = axis ;
axis([a(1) max(t) a(3) a(4)])
title('')
xlabel('Zeit t')
ylabel('x1, x2')
legend('x1','x2')
subplot(122)
plot(x(:,1),x(:,2))
grid on;
title('State trajectories')
xlabel('x1')
ylabel('x2')
[y,t,x] = initial (sys,'r-',[4 -1],12) ;    % unforced response
[y,t,x] = initial (sys,'r-',[4 -1],12)
clc
[y,t,x] = initial (sys,'r-',[4 -1],200)
clc
[y,t,x] = initial (sys,'r-',[4 -1],12) ;    % unforced response
pause
figure
subplot(221)
plot(t,y)
grid on;
a = axis ;
axis([a(1) max(t) a(3) a(4)])
title('Unforced response')
xlabel('Zeit t')
ylabel('y (t)')
subplot(223)
plot(t,x(:,1),'r-',t,x(:,2),'g--')
grid on;
a = axis ;
axis([a(1) max(t) a(3) a(4)])
title('')
xlabel('Zeit t')
ylabel('x1, x2')
legend('x1','x2')
subplot(122)
plot(x(:,1),x(:,2))
grid on;
title('State trajectories')
xlabel('x1')
ylabel('x2')
clc
[y,t,x] = initial (sys,'r-',[4 -1],50) ;    % unforced response
figure
subplot(221)
plot(t,y)
grid on;
a = axis ;
axis([a(1) max(t) a(3) a(4)])
title('Unforced response')
xlabel('Zeit t')
ylabel('y (t)')
subplot(223)
plot(t,x(:,1),'r-',t,x(:,2),'g--')
grid on;
a = axis ;
axis([a(1) max(t) a(3) a(4)])
title('')
xlabel('Zeit t')
ylabel('x1, x2')
legend('x1','x2')
subplot(122)
plot(x(:,1),x(:,2))
grid on;
title('State trajectories')
xlabel('x1')
ylabel('x2')
clc
figure
sys2in = [ tf(5,[1 1 10]) , tf(1,[1 1]) ] ;
subplot(211)
impulse(sys2in);             % Impulse response
subplot(212)
step (sys2in);               % Step response
sys2in
dcgain(sys2in)
clc
sys2in = [ tf(1,[1 1]) ; tf(1000,[1 5 1000]) ] ;
sys2in = [ tf(1,[1 1]) ; tf(1000,[1 5 1000]) ]
sys2in = [ tf(1,[1 1]) ; tf(1000,[1 5 1000]) ] ;
[u,t] = gensig('square',3,10,0.01) ;   % beliebiges Eingangssignal
[y,t] = lsim(sys2in,u,t) ;              % Antwort auf beliebiges Eingangssignal
plot(t,u,'r--',t,y(:,1),'b-.',t,y(:,2),'g-')
title('Antwort auf beliebiges Eingangssignal')
legend('u(t)','PT_1','PT_2',1)
xlabel('Zeit t')
clc
sys2in = [ tf(1,[1 1]) ; tf(1000,[1 5 1000]) ] ;
[u,t] = gensig('square',3,10,0.01) ;   % beliebiges Eingangssignal
[y,t] = lsim(sys2in,u,t) ;              % Antwort auf beliebiges Eingangssignal
plot(t,u,'r--',t,y(:,1),'b-.',t,y(:,2),'g-')
title('Antwort auf beliebiges Eingangssignal')
legend('u(t)','PT_1','PT_2')
xlabel('Zeit t')
sys2in
sys2in = [ tf(1,[0.1 1]) ; tf(10000,[1 5 10000]) ] ;
[u,t] = gensig('square',3,10,0.01) ;   % beliebiges Eingangssignal
[y,t] = lsim(sys2in,u,t) ;              % Antwort auf beliebiges Eingangssignal
plot(t,u,'r--',t,y(:,1),'b-.',t,y(:,2),'g-')
title('Antwort auf beliebiges Eingangssignal')
legend('u(t)','PT_1','PT_2')
xlabel('Zeit t')
sys2in = [ tf(1,[0.1 1]) ; tf(1000,[1 25 1000]) ] ;
[u,t] = gensig('square',3,10,0.01) ;   % beliebiges Eingangssignal
[y,t] = lsim(sys2in,u,t) ;              % Antwort auf beliebiges Eingangssignal
plot(t,u,'r--',t,y(:,1),'b-.',t,y(:,2),'g-')
title('Antwort auf beliebiges Eingangssignal')
legend('u(t)','PT_1','PT_2')
xlabel('Zeit t')
clc
sys = tf([3 -1],[-2 1 1])
w = [-j , -2-j , -1+j]
[ evalfr(sys,w(1)) ; evalfr(sys,w(2)) ; evalfr(sys,w(3))]
H = freqresp(sys,w)
clcl
clc
sys = tf([3 -1],[-2 1 1])
w = [-j , -2-j , -1+j]
[ evalfr(sys,w(1)) ; evalfr(sys,w(2)) ; evalfr(sys,w(3))]
H = freqresp(sys,w)
clc
sysPT1  = tf (1,[0.05 1])
sysPT1d = c2d(sysPT1,0.05)
pause
sysPT2 = tf (10,[1 0.05 10])
clc
sysPT2 = tf (10,[1 0.05 10])
d = [sqrt(2)/2 1.6 3] ;
for n = 1:1:length(d) ,
sysPT2 = [ sysPT2 ; tf(10,[1 d(n) 10]) ] ;
end;
clc
figure
subplot(121) ,
bode(sysPT1,'r-',sysPT1d,'b--')
subplot(122) ,
hold on;
stil = {'r-' 'b-.' 'k-' 'g--'}
for n = 1:1:size(sysPT2,1) ,
%            bode(sysPT2(n),stil{n});
bode(sysPT2(n),stil{1+mod(n-1,size(sysPT2,1))});
end;
sysPT1d = c2d(sysPT1,0.05)
clc
sysPT1d = c2d(sysPT1,0.005)
subplot(121) ,
bode(sysPT1,'r-',sysPT1d,'b--')
figure
subplot(121) ,
bode(sysPT1,'r-',sysPT1d,'b--')
subplot(122) ,
hold on;
stil = {'r-' 'b-.' 'k-' 'g--'}
for n = 1:1:size(sysPT2,1) ,
%            bode(sysPT2(n),stil{n});
bode(sysPT2(n),stil{1+mod(n-1,size(sysPT2,1))});
pause
end;
CLC
clc
syspt1
sysPT1
figure
sysPT1dneu = d2d(sysPT1d,0.01)
step(sysPT1,'r-',sysPT1d,'b-.',sysPT1dneu,'g--')
legend('sysPT1','sysPT1d','sysPT1dneu',4)
set(findobj('Tag','LTIdisplayAxes'),'XLim',[0,0.3])
figure
sysPT1dneu = d2d(sysPT1d,0.01)
step(sysPT1,'r-',sysPT1d,'b-.',sysPT1dneu,'g--')
legend('sysPT1','sysPT1d','sysPT1dneu')
set(findobj('Tag','LTIdisplayAxes'),'XLim',[0,0.3])
clc
sysPt1
sysPT1
sysPT1d
clc
sysPT1  = tf (1,[0.05 1])
sysPT1d = c2d(sysPT1,0.05)
figure
sysPT1dneu = d2d(sysPT1d,0.01)
step(sysPT1,'r-',sysPT1d,'b-.',sysPT1dneu,'g--')
legend('sysPT1','sysPT1d','sysPT1dneu',4)
set(findobj('Tag','LTIdisplayAxes'),'XLim',[0,0.3])
legend('sysPT1','sysPT1d','sysPT1dneu')
set(findobj('Tag','LTIdisplayAxes'),'XLim',[0,0.3])
clc
sysPT1dneu = d2d(sysPT1d,0.005)
step(sysPT1,'r-',sysPT1d,'b-.',sysPT1dneu,'g--')
clc
sys  = zpk([],[-1 -1 -1],4)
figure
margin (sys)
[Gm,Pm,Wcg,Wcp] = margin(sys)
stabil = allmargin(sys)
clc
stabil = allmargin(sys)
stabil.DelayMargin
get(sys)
clc
stabil = allmargin(sys)
sys.ioDelay = stabil.DelayMargin + 0.01
allmargin(sys)
clc
ltiview
help ltivviewer
help ltiview
doc (ltiview
doc ltiview
h = ltiview({'step';'pzmap'},sys);
ltiview('current',tf(dcgain(sys),[0.3 1]),h)
clc
linearSystemAnalyzer({'step';'pzmap'},sys);
linearSystemAnalyzer('current',tf(dcgain(sys),[0.3 1]),h)
sisotool