%-- 12.04.2024 14:34 --%
tf([2 -3],[1 1])
h = tf([2 -3],[1 1])
clc
h = tf([2 -3],[1 1])
s = tf('s')
hs =  (2*s-3) / (s+1)
hs =  (2*s-3) / (1+s)
hs =  (-3 - 2*s) / (1+s)
clc
h = tf([2 -3],[1 1])
h = tf([2 0 -3],[1 1]
h = tf([2 -3],[1 1])
h = tf([2  0 -3],[1 1])
h = tf([2  0 -3],[1 1 0])
hs =  (-3 - 2*s) / (1+s)
clc
hs =  (-3 - 2*s^2) / (1+s)
clc
h11 = tf([2 -3],[1 1]);
h12 = tf([1 1 -6],[1 5]);
h21 = tf([1 2],[1 5 4]);
h22 = tf(-1,[2 6 10]);
H = [h11 h12 ; h21 h22]
clc
s = tf('s');
h11 = (2*s-3) / (s+1);
h12 = (s^2+s-6) / (s+5);
h21 = (s+2) / (s^2+5*s+4);
h22 = -1 / (2*s^2+6*s+10);
H = [h11 h12 ; h21 h22]
NUM = { [2 -3] [1 1 -6];[1 2] -1 };
DEN = { [1  1] [1 5];[1 5 4] [2 6 10] };
H = tf(NUM,DEN)
clc
G = tf([1 2 ; 3 0])
clc
G = tf([1 2 ; 3 0])
tf(3)
clc
h =  zpk([-6 1 1],[-5 1],3)
pause
s = zpk('s')
h = 2 * 1 / ((s-1)*(s+2))
tf(h)
clc
sys = ss([1 2 ; 3 4],[1 ; 0],[0 1],0)
SYS = ss([1 2 ; 3 4],[1 1 0 ; 0 1 2],[0 1 ; 1 2 ; 3 1],0)

%-- 19.04.2024 14:30 --%
freq = [0.01 0.1 1 10 100 1000 10000] ;       % Frequencies
resp  = (1-j*freq) ./(1+freq.^2) ;            % Create PT1
sysfrd   = frd(resp,freq,'Units','rad/s')
bode(sysfrd)
freq = logspace(-2,4,7)
resp2 = tf(1,[1 1])
hold on
sysfrd2 = frd(resp2,freq,'Units','rad/s');
clc
freq = [0.01 0.1 1 10 100 1000 10000] ;       % Frequencies
resp  = (1-j*freq) ./(1+freq.^2) ;            % Create PT1
sysfrd   = frd(resp,freq,'Units','rad/s')
pause
% Create PT1 by tf
freq = logspace(-2,4,7)
resp2 = tf(1,[1 1])
sysfrd2 = frd(resp2,freq,'Units','rad/s');
sysfrd2 = frd(resp2,freq,'Units','rad/s','--');
clc
freq = logspace(-2,4,50);
sysPT2  = frd(tf([1],[1 .2 1]),freq);
pause
bode(sysfrd,'r-',sysfrd2,'k--',sysPT2,'b-')
grid on; zoom on; hold on;
tf([1],[1 .2 1])
sysPT3  = frd(tf([1],[1 1]),freq);
bode(sysfrd,'r-',sysfrd2,'k--',sysPT2,'b-',sysPT3)
clc
claer
clear
clc
h = tf([1 -0.5],[1 1 -2],0.01)
z = tf('z')
h = (z-0.5)/(z^2 + z - 2)
z = tf('z',0.01)
h = (z-0.5)/(z^2 + z - 2)
h = filt([1 -0.5],[1 1 -2],0.01)
clc
h = zpk(0.5,[-2 1],1,0.01)
pause
z = zpk('z',0.01)
h = (z-0.5)/((z+2)*(z-1))
z = tf('z',0.01)
h = (z-0.5)/((z+2)*(z-1))
clc
% continuous time delays
h11 = tf([2 -3],[1 1]);
h12 = tf([1 1 -6],[1 5]);
h21 = tf([1 2],[1 5 4]);
h22 = tf(-1,[2 6 10]);
H = [h11 h12 ; h21 h22]
set(H,'IODelay',[0 0.4 ; 0 0]) ;
set(H,'IODelay',[0 0.4 ; 0 0])
H
clc
h = tf([1 -0.5],[1 1 -2],0.01,'InputDelay',4)
h = delay2z(h)
clc
h = tf([1 -0.5],[1 1 -2],0.01,'InputDelay',4)
h = tf([1 -0.5],[1 1 -2],0.01,'InputDelay',0)
h.InputDelay = 7
clc
H(1,2)
pade( H(1,2) )
figure
plot(ans,H(1,2))
hpade = pade( H(1,2) )
plot(hpade,H(1,2))
step(hpade,H(1,2))
doc pade
hpade = pade( H(1,2), 3)
hpade = pade( H(1,2), 2)
h = tf([1 -0.5],[1 1 -2],0.01,'InputDelay',2)
pade(h)
clc
h = tf([1 -0.5],[1 1 -2],0.01,'InputDelay',2)
hp
hpade = pade( h)
step(h,hpade)
clc
sys = tf([1 -0.5],[1 1 -2],-1,'Notes','LTI-Objekt')
set(sys,'Ts',0.05,'InputName','Eingang')
pause
sys.OutputName = 'Ausgang'
clc
abtastzeit = sys.Ts
sys.Ts
notiz =  get(sys,'notes')
notiz =  get(sys,'Notes')
get(sys)
clc
h = tf([2 -3],[1 1])
get(h)
[num,den,Ts] = tfdata(h)
num{1}
num{1.1}
num{1,1}
clc
num{1,1}
[num,den,Ts] = tfdata(h,'v')
clc
sys1 = ss([ 1 2 ; 3 4 ],[ 1 1 ; 0 1 ],[ 3 1 ],0) ;
sys2 = ss([ 4 3 ; 2 1 ],[ 2 3 ; 1 4 ],[ 0 1 ],0) ;
sys = sys1 + sys2
sys1
sys2
sys = sys1 + sys2
clc
sys1.a , sys2.a, sys.a
sys = sys1 - sys2 ;
sys1.a , sys2.a, sys.a
sys1.c , sys2.c, sys.c
sys = sys1 + sys2 ;
sys1.c , sys2.c, sys.c
clc
h11
h12
h11*h12
h12*h11
series(h11, h12)
doc series
clc
h11 = tf([2 1],[1 0.1]);       % Eingang 1, Ausgang 1
h12 = tf(1,[1 0.5]);           % Eingang 2, Ausgang 1
h21 = tf(0,1);                 % Eingang 1, Ausgang 2
h22 = tf(1,[1 -1]);            % Eingang 2, Ausgang 2
systf = tf([h11 h12;h21 h22])
teilsys = systf(1,2)
clc
teilsys = systf(1,2)
systf =
systf = tf(1,[1 0])
systf
systfclc
clc
h22 = tf(1,[1 -1]);            % Eingang 2, Ausgang 2
systf = tf([h11 h12;h21 h22])
systf(1,2) = tf(1,[1 0])
clc
systf
systf(:,1) = []
clc
systf
systf(:,2) = [ tf(1,[1 -1]) ; tf(1,1) ]
clc
integrator   = tf(1,[3 0])
proportional = tf(2,1)
feedback(inttegrator,proportional)
feedback(integrator,proportional)
feedback(integrator,proportional,+1)
clc
sysc  = tf([1],[1 .7 1])            % PT_2
step(sysc)
sysd  = c2d (sysc,1.5)               % Halteglied 0.~Ordnung
sysd1 = c2d (sysc,1.5,'foh')         % Halteglied 1.~Ordnung
sysd2 = c2d (sysc,1.5,'tustin')      % Tustin--Approximation
figure
step(sysc,'r-',sysd,'c--',sysd1,'g-.',sysd2,'k-',20)
legend('sysc','sysd (ZOH)','sysd1 (FOH)','sysd2 (Tustin)')
clc
sysc  = tf(1,[1 1])                % PT_1
sysd  = c2d (sysc,2)               % Halteglied 0.~Ordnung
sysdd = d2d (sysd,0.7)             % Neue Abtastzeit
figure
step(sysc,'r-',sysd,'c--',sysdd,'g-.',10)
legend('sysc','sysd (ZOH)','sysdd  (ZOH resampled)')
sysddd = d2d (sysdd,0.01)             % Neue Abtastzeit
step(sysc,'r-',sysd,'c--',sysdd,'g-.',sysddd,10)
clear
clc
sys = ss([ 1 2 ; 3 4 ],[ 1 1 ; 0 1 ],[ 3 1 ],0)
class(sys)
isa(sys,'cell')
isa(sys,'ss')
clc
isct(sys)
isdt(sys)
issiso(sys)
sys
isempty(sys)
clc
sys = [ tf(zpk([-1],[1 0],2)) , tf([2 1 -6],[2 1 1 -4 ]) ]
dcgain(sys)
damp(sys)
clc
sys =  tf(1,[2 -3 1 2])
damp(sys)
step(sys)
clc
sys = zpk([-0.2 0.6],[-0.5 -0.7-0.8*i -0.7+0.8*i 0.3],2)
pole(sys)
zeros(sys)
zero(sys)
[num,den] = tfdata(tf(sys),'v') ;
[num,den] = tfdata(tf(sys),'v')
roots(den)
[z,k] = zero(sys)
help zero
clc
sys
sysd = c2d(sys,1)
% Pole zero map 1
sysd = c2d(sys,1)
figure
subplot(121)
pzmap(sys)
sgrid
axis([-1 1 -1 1 ])
subplot(122)
pzmap(sysd)
zgrid
clc
Z = { [] [-6 1 1 ] ; [1 2] -1 };
P = { [-2 1] [-5 1] ; [-4 -1] [-1 -1+i -1-i] };
K = [2 3 ; 1 -1];
H = zpk(Z,P,K)
sys = H(2,2);
figure
iopzmap(sys,H)
clc
o