Lab-4 Controls
Lab-4 Controls
Class: 5A
Objectives
To demonstrate the key components of a translational mechanical system, model the system and
finally to obtain various responses using computation and observe it on rectilinear plant.
In Lab Task
Code:
syms f s
m1=1;
m2=1;
m3=1;
k1=6;
k2=4;
k3=3;
c=2;
a=[m1*s^2+k1,-k1,0;
-k1,m2*s^2+k1+k2,-k2;
0,-k2,m3*s^2+k2+k3+c*s;]
b=[f;0;0]
x=inv(a)*b
Output:
X1(s)/F(s) = (s4 + 2s3 + 17s2 + 20s + 54)/(s6 + 2s5 + 23s4 + 32s3 + 120s2 + 48s + 72)
X2(s)/F(s) = (6s2 + 12s + 42))/(s6 + 2s5 + 23s4 + 32s3 + 120s2 + 48s + 72)
X3(s)/F(s) = (24)/(s6 + 2s5 + 23s4 + 32s3 + 120s2 + 48s + 72)
Code:
clear all;
close all;
B=[6 12 42 ];
A=[1 2 23 32 120 48 72];
T2=tf(B,A)
subplot(3,2,1);
step(T2)
grid on;
subplot(3,2,2);
impulse(T2)
grid on;
t=0:0.01:10;
u=t;
y=lsim(T2,u,t);
subplot(3,2,3);
plot(t,y);
xlabel 'Time (seconds)'
ylabel 'Amplitude'
title 'Ramp'
grid on;
f=2;
w=2.*pi.*f;
x=sin(w.*t);
z=lsim(T2,x,t);
subplot(3,2,4);
plot(t,z);
grid on;
xlabel 'Time (seconds)'
ylabel 'Amplitude'
title 'Sinusoid'
n=t.^2;
z=lsim(T2,n,t);
subplot(3,2,5);
plot(t,z);
grid on;
xlabel 'Time (seconds)'
ylabel 'Amplitude'
title 'Parabola'
Output:
Code:
clear all;
close all;
B=[24];
A=[1 2 23 32 120 48 72];
T3=tf(B,A)
subplot(3,2,1);
step(T3)
grid on;
subplot(3,2,2);
impulse(T3)
grid on;
t=0:0.01:10;
u=t;
y=lsim(T3,u,t);
subplot(3,2,3);
plot(t,y);
xlabel 'Time (seconds)'
ylabel 'Amplitude'
title 'Ramp'
grid on;
f=2;
w=2.*pi.*f;
x=sin(w.*t);
z=lsim(T3,x,t);
subplot(3,2,4);
plot(t,z);
grid on;
xlabel 'Time (seconds)'
ylabel 'Amplitude'
title 'Sinusoid'
n=t.^2;
z=lsim(T3,n,t);
subplot(3,2,5);
plot(t,z);
grid on;
xlabel 'Time (seconds)'
ylabel 'Amplitude'
title 'Parabola'
Output:
Code:
clc;
syms f s
m1=1;
m2=1;
m3=1;
k1=200;
k2=400;
k3=300;
k4=0;
c1=0;
c2=0;
c3=0.5;
a=[m1*s^2+k1+k2+c1*s, -(k2+c1*s), 0;
-(k2+c1*s), m2*s^2+k2+c1*s+k3+c2*s, -(k3+c2*s);
0, -(k3+c2*s), m3*s^2+k3+c2*s+k4+c3*s;]
b=[f;0;0]
x=inv(a)*b
Output:
48000000)
Code:
clear all;
close all;
B=[2 1 2000 700 240000];
A=[2 1 3200 1300 1120000 260000 48000000];
T1=tf(B,A)
subplot(3,2,1);
step(T1)
xlim([0 50]);
grid on;
subplot(3,2,2);
impulse(T1)
xlim([0 50]);
grid on;
t=0:0.01:10;
u=t;
y=lsim(T1,u,t);
subplot(3,2,3);
plot(t,y);
xlabel 'Time (seconds)'
ylabel 'Amplitude'
title 'Ramp'
grid on;
f=2;
w=2.*pi.*f;
x=sin(w.*t);
z=lsim(T1,x,t);
subplot(3,2,4);
plot(t,z);
grid on;
xlabel 'Time (seconds)'
ylabel 'Amplitude'
title 'Sinusoid'
n=t.^2;
z=lsim(T1,n,t);
subplot(3,2,5);
plot(t,z);
grid on;
xlabel 'Time (seconds)'
ylabel 'Amplitude'
title 'Parabola'
Output:
Code:
clear all;
close all;
B=[800 400 240000];
A=[2 1 3200 1300 1120000 260000 48000000];
T2=tf(B,A)
subplot(3,2,1);
step(T2)
xlim([0 50]);
grid on;
subplot(3,2,2);
impulse(T2)
xlim([0 100]);
grid on;
t=0:0.01:10;
u=t;
y=lsim(T2,u,t);
subplot(3,2,3);
plot(t,y);
xlabel 'Time (seconds)'
ylabel 'Amplitude'
title 'Ramp'
grid on;
f=2;
w=2.*pi.*f;
x=sin(w.*t);
z=lsim(T2,x,t);
subplot(3,2,4);
plot(t,z);
grid on;
xlabel 'Time (seconds)'
ylabel 'Amplitude'
title 'Sinusoid'
n=t.^2;
z=lsim(T2,n,t);
subplot(3,2,5);
plot(t,z);
grid on;
xlabel 'Time (seconds)'
ylabel 'Amplitude'
title 'Parabola'
Output:
Conclusion
Modeling translational mechanical systems is a fundamental aspect of mechanical
engineering and control theory, enabling engineers to predict and optimize the
behavior of various mechanical components and systems. By representing these
systems using mathematical equations, engineers can simulate and analyze their
responses to different inputs and disturbances. This modeling approach is crucial in
designing efficient and reliable machines and mechanisms. However, the accuracy
of the model relies heavily on the assumptions and simplifications made during the
modeling process, which may not always capture the complexities of real-world
systems. Therefore, a critical analysis is essential to ensure that the model's
predictions align with experimental data and that it can effectively guide the design
and control of mechanical systems. Additionally, factors like friction, nonlinearities,
and material properties can significantly affect the accuracy of the model,
highlighting the importance of thorough testing and validation when applying these
models in practical engineering applications.