
%% Införa Laplace 'variable' s.
s=tf('s');

%% Bestäm använda storheter
k = 1;
T0 = 4;

b = 0.5;
a = 0.82;
d = b/a

zeta = 1/(sqrt(((2*pi) / log(d))^2 + 1) )
w0 = (2*pi)/(T0*sqrt(1 - zeta^2 ))


Gp = (k*w0^2)/(s^2 + 2*zeta*w0*s + w0^2 )

Gtot = 1/((1 + 1.15*s)^2)

Gr = Gtot / (Gp * (1 - Gtot));
Gr = minreal(Gr)

Hr = c2d(Gr, 0.2, 'tustin')

%Gp = 2.48/(s^2 + 2*0.0784*1.576*s + 2.48);
%Gr = Gtot / (Gp * (1 - Gtot));
%Gr = minreal(Gr)

%{
step(G)
ylim([0 2])
xlim([0 12])
stepinfo(G)
grid on
yticks([0 1/3 2/3 1 4/3 5/3 2])
%}

%Gr = (s^2 + 0.247*s +2.48) / (3.28*s^2 + 5.704*s)
%






