Q.
1)
MATLAB CODE:
clc;
clear all;
close all;
%% Q.1) Pole-Zero Plot for the Given Transfer Function
a = [1 0]; %% Defining Numerator
b = [1 10 89]; %% Defining Numerator
G = tf(a,b); %% System Transfer Function
pzmap(G, 'b') %% Pole-Zero Plot
Pole-Zero Plot:
Poles and Zeros Locations:
Since the system Two Poles (−5 ± 𝑗8) are located at Left-Half of s-plane. Hence Given
Transfer Function is Stable.
Q.2)
MATLAB CODE:
clc;
clear all;
close all;
%% Q.2) Pole-Zero Plot for the Given Transfer Function
a = [1 0 25]; %% Defining Numerator
b = [1 4 29 0]; %% Defining Numerator
G = tf(a,b); %% System Transfer Function
pzmap(G, 'b') %% Pole-Zero Plot
Pole-Zero Plot:
Poles and Zeros Locations:
Since the system two Poles (−2 ± 𝑗5) are located at Left-Half of s-plane and third is
located at Origin (s = 0). Hence Given Transfer Function is Stable.
Q.3)
MATLAB CODE:
clc;
clear all;
close all;
%% Q.3) Pole-Zero Plot for the Given Transfer Function
a = [1 10]; %% Defining Numerator
b = [1 15 56]; %% Defining Numerator
G = tf(a,b); %% System Transfer Function
pzmap(G, 'b') %% Pole-Zero Plot
Pole-Zero Plot:
Poles and Zeros Locations:
Since Poles (−8 𝑎𝑛𝑑 − 7)) are located at Left-Half of s-plane. Hence Given Transfer
Function is Stable.
Q.4)
MATLAB CODE:
clc;
clear all;
close all;
% Q.4) Bode Plots
% For the Transfer Function G1
a1 = [1];
b1 = [0.01 0.2 1];
G1 = tf(a1,b1);
figure(1)
bode(G1)
grid on;
% For the Transfer Function G2
a2 = [5];
b2 = [0.5 1 0];
G2 = tf(a2,b2);
figure(2)
bode(G2)
grid on;
% For the Transfer Function G3
a3 = [1];
b3 = [1 0.5 3];
G3 = tf(a3,b3);
figure(3)
bode(G3)
grid on;
% For the Transfer Function G4
a4 = [0.1 1];
b4 = [0.2 1];
G4 = tf(a4,b4);
figure(4)
bode(G4)
grid on;
Bode Plot for Transfer Function G1:
The Bode diagram has the initial slope of the magnitude plot is 0 dB/decade, the
maximum phase zero degree and the slope becomes -40dB/decade after w =10
radians/sec.
Bode Plot for Transfer Function G2:
The Bode diagram has the initial slope of the magnitude plot is -20 dB/decade, and the
slope becomes -40dB/decade after w =2 radians/sec and the maximum phase of -90o.
Bode Plot for Transfer Function G3:
The Bode diagram has the initial slope of the magnitude plot is 0 dB/decade, the final
slope becomes -20dB/decade and the maximum phase of 0o.
Bode Plot for Transfer Function G4:
The Bode diagram has the initial slope of the magnitude plot is 0 dB/decade, the final
slope becomes 0dB/decade and the maximum phase of 0o.
Transfer Function G1 G2 G3 G4
Bode Plot B D A C
Q.5)
MATLAB CODE:
clc;
clear all;
close all;
% Q.5) Step Responses
% For the Transfer Function G1
a1 = [1];
b1 = [0.01 0.2 1];
G1 = tf(a1,b1);
figure(1)
step(G1)
grid on;
% For the Transfer Function G2
a2 = [5];
b2 = [0.5 1 0];
G2 = tf(a2,b2);
figure(2)
step(G2)
grid on;
% For the Transfer Function G3
a3 = [1];
b3 = [1 0.5 3];
G3 = tf(a3,b3);
figure(3)
step(G3)
grid on;
% For the Transfer Function G4
a4 = [0.1 1];
b4 = [0.2 1];
G4 = tf(a4,b4);
figure(4)
step(G4)
grid on;
Step Response for the Transfer Function G1:
In the step response, the initial slope is Positive and the steady state value of output is 1.
Step Response for the Transfer Function G2:
In the step response, the initial slope is 5 and remains as constant, so that the steady state-
value does not exist.
Step Response for the Transfer Function G3:
In the step response, the initial slope is Positive with under-damped oscillations and the
steady state-value is 0.333.
Step Response for the Transfer Function G4:
In the step response, the initial slope is Positive the steady state-value is 1.
Transfer Function G1 G2 G3 G4
Step Response III I IV II
Q.6)
a) `MATLAB CODE:
%% Q.6) a) definig System of Equations using ode45 solver
function dydt = odefunction(y,f,m1,m2,c1,c2,k1,k2)
dydt = zeros(4,1);
dydt(1) = y(2);
dydt(2) = -c1/m1*y(2)-k1/m1*y(1)+c1/m1*y(4)+k2/m1*y(3)+f./m1;
dydt(3) = y(4);
dydt(4) = -(c1+c2)/m2*y(4)-(k1+k2)/m2*y(3)+c1/m2*y(2)+k1/m2*y(1);
end
b) MATLAB CODE:
clc;
clear all;
close all;
%% Q.6) b) plotting two positions X1(t) and X2(t) for step Input
%% Defining System Parameters
m1 = 10; % Mass 1 [kg]
m2 = 100; % Mass 2 [kg]
c1 = 100; % Damping Coefficient 1 [Ns/m]
c2 = 1000; % Damping Coefficient 2 [Ns/m]
k1 = 1e4; % Spring Coefficient 1 [N/m]
k2 = 1e5; % Spring Coefficient 2 [N/m]
Tend = 10; % Simulation Stop Time [s]
syms t y
f = @(t) 5*1*(0<=t);
tspan = [0 Tend];
y0 = [0 0 0 0];
[t,y] = ode45(@(t,y)odefunction(y,f(t),m1,m2,c1,c2,k1,k2),tspan,y0);
%% Plotting x1(t)
figure(1)
plot(t,y(:,1),'b-','LineWidth',2)
grid on
xlabel('t(sec)')
ylabel('x_1 (t)')
title('x1(t) vs t','interpreter','latex')
%% Plotting x2(t)
figure(2)
plot(t,y(:,3),'b-','LineWidth',2)
grid on
xlabel('t(sec)')
ylabel('x_2 (t)')
title('x2(t) vs t','interpreter','latex')
plot of x1(t):
plot of x2(t):
c) MATLAB CODE:
clc;
clear all;
close all;
%% Q.6) c) plotting two positions X1(t) and X2(t) for sinusoidal Excitation
%% Defining System Parameters
m1 = 10; % Mass 1 [kg]
m2 = 100; % Mass 2 [kg]
c1 = 100; % Damping Coefficient 1 [Ns/m]
c2 = 1000; % Damping Coefficient 2 [Ns/m]
k1 = 1e4; % Spring Coefficient 1 [N/m]
k2 = 1e5; % Spring Coefficient 2 [N/m]
Tend = 10; % Simulation Stop Time [s]
syms t y
f = @(t)3*sin(10*t);
tspan = [0 Tend];
y0 = [0 0 0 0];
[t,y] = ode45(@(t,y)odefunction(y,f(t),m1,m2,c1,c2,k1,k2),tspan,y0);
%% Plotting x1(t)
figure(1)
plot(t,y(:,1),'b-','LineWidth',2)
grid on
xlabel('t(sec)')
ylabel('x_1 (t)')
title('x1(t) vs t','interpreter','latex')
%% Plotting x2(t)
figure(2)
plot(t,y(:,3),'b-','LineWidth',2)
grid on
xlabel('t(sec)')
ylabel('x_2 (t)')
title('x2(t) vs t','interpreter','latex')
plot of x1(t):
plot of x2(t):