
%% Section 1
% Define the Laplace variable 's'
s = tf('s');

% Set sample time to 2 seconds
T = 2;

% Set critical frequency to 0.1 rad/s
Omega0 = 0.1;
% Set quality factor to 1
Q = 1;

% Create notch filter
G1 = (s^2 + Omega0^2)/(s^2 + Omega0/Q*s + Omega0^2)

figure()
bode(G1)
%% Section 2
% Use bilinear transformation (tustin) to convert to z-domain
G1d = c2d(G1, T, 'tustin')

figure()
bode(G1, G1d, {0, 1.5})
%% Section 3

% Set critical frequency to 0.7 rad/s
Omega0 = 0.7;
% Set quality factor to 1
Q = 1;

% Create notch filter
G2 = (s^2 + Omega0^2)/(s^2 + Omega0/Q*s + Omega0^2)
G2d = c2d(G2, T, 'tustin')

figure()
bode(G2, G2d, {0,1.5})