Lab Report-4
Lab Report-4
Danish Zulfiqar
Names Farrukh Mukhtar
FA21-BEE-42
Registration Numbers FA21-BEE-048
Class BEE-5B
Lab Assessment
Post Lab Total
Pre-Lab In-Lab Data
Data Analysis Writing Style
Presentation
Introduction
In the realm of translational mechanical systems, the core components are mass, spring, and
damper. These systems are characterized by their degrees of freedom, with each representing an
independent motion point. Equations of motion are essential for understanding system behavior,
and they can be derived either through Newton's laws or observation-based methods. Cramer's
rule is often used to solve these equations, allowing us to compute crucial transfer functions.
When it comes to control and stability, PID (Proportional Integral Derivative) controllers are the
go-to choose in industrial applications. They excel at regulating various process variables,
ensuring precision and stability in system operations.
In-Lab Task
Task 01: Make mathematical model of the system using laws of Physics (Single Mass-Spring-
Damper system has been modelled as an example). Calculate the transfer functions X1(s)/F(s) and
X2(s)/F(s) Calculate impulse, step, ramp, parabolic and sinusoidal responses by taking relevant
values of F(s). Plot the time domain results obtained.
:
Code:
Transfer function from 1nd equation of motion (X1(s)/F(s)):
clc
clear
close all
figure();
figure();
ramp_input = time;
[response_ramp, time] = lsim(system_tf, ramp_input, time);
plot(time, response_ramp, 'linewidth', 2), grid on;
hold on;
plot(time, ramp_input, 'linewidth', 2), grid on;
legend('output', 'input');
title('Ramp Response');
xlabel('Time');
ylabel('Amplitude');
figure();
sinusoidal_input = sin(time);
[response_sinusoidal, time] = lsim(system_tf, sinusoidal_input,
time);
plot(time, response_sinusoidal, 'linewidth', 2), grid on;
hold on;
plot(time, sinusoidal_input, 'linewidth', 2), grid on;
legend('output', 'input');
title('Sinusoidal Response');
xlabel('Time');
ylabel('Amplitude');
figure();
parabolic_input = time.^2/2;
[response_parabolic, time] = lsim(system_tf, parabolic_input,
time);
plot(time, response_parabolic, 'linewidth', 2), grid on;
hold on;
plot(time, parabolic_input, 'linewidth', 2), grid on;
legend('output', 'input');
title('Parabolic Response');
xlabel('Time');
ylabel('Amplitude');
G = tf([1], [1 1 3 1 1]);
t_span = 0:0.001:10;
[y1, t] = step(G);
plot(t, y1, 'linewidth', 2), grid on;
title('Step Response');
xlabel('Time');
ylabel('Amplitude');
figure();
[y2, t] = impulse(G);
plot(t, y2, 'linewidth', 2), grid on;
title('Impulse Response');
xlabel('Time');
ylabel('Amplitude');
figure();
u_ramp = t;
[y3, t] = lsim(G, u_ramp, t);
plot(t, y3, 'linewidth', 2), grid on;
hold on;
plot(t, t, 'linewidth', 2), grid on;
legend('output', 'input');
title('Ramp Response');
xlabel('Time');
ylabel('Amplitude');
figure();
u_sinusoidal = sin(t);
[y4, t] = lsim(G, u_sinusoidal, t);
plot(t, y4, 'linewidth', 2), grid on;
hold on;
plot(t, u_sinusoidal, 'linewidth', 2), grid on;
legend('output', 'input');
title('Sinusoidal Response');
xlabel('Time');
ylabel('Amplitude');
figure();
u_parabolic = t.^2/2;
[y5, t] = lsim(G, u_parabolic, t);
plot(t, y5, 'linewidth', 2), grid on;
hold on;
plot(t, u_parabolic, 'linewidth', 2), grid on;
legend('output', 'input');
title('Parabolic Response');
xlabel('Time');
ylabel('Amplitude');
Task 01
X1(𝑠) s4
=
F(s) s6 + s5 + 5s4 + 3s3 + 6s2 + s + 1
𝑥1(𝑠) =
Similarly
X2(𝑠) s2+s+2
=
F(s) s6+s5+5s4+3s3+6s2+s+1
X3(𝑠) 1
=
F(s) s6+s5+5s4+3s3+6s2+s+1
Code:
clc
clear
all
close
all
sys=tf([1],[1 1 5 3 6 1
1]); step(sys);
legend('Step Response');
Output:
Figure
Our modeling approach adhered to Newton's law, ensuring equilibrium between external and
resistive forces. We delved into the purpose and characteristics of different input signals
commonly used in control systems:
To capture the essence of these mechanical systems, we constructed free body diagrams and
derived transfer functions. In the case of two-degree-of-freedom systems, we formulated and
simultaneously solved two equations of motion. Subsequently, we employed MATLAB to
visualize and analyze the diverse system responses.
Additionally, we delved into the PID controller, comprehending its significance and components: