LAB
No 3: EPE
Title: Mathematical Modeling of 4 DOF mass spring
systems (Rectilinear system). Evaluation of Transfer functions between input
voltage and all of the four mass positions.
Objectives:
the objective of this Lab is to model 4 DOF
rectilinear systems, using symbolic MATH toolbox.
Task#
01
Matlab
Code:
%% Task 1 Lab03
clc
close all
clear all
syms x y;
x+x+y
rho = sym('(1 + sqrt(5))/2')
syms a b c x;
f=a*x^2+b*x+c
% Creating matrix of
symbolic variables
syms a b c;
A=[a b c;c a b;b c a]
%Creating a Matrix of
Symbolic Numbers
A=[1 0.2 3; 0.5
0.8 0.1; 1 0.6
0.6]
A=sym(A)
Results:
(From the Command window)
ans =
2*x + y
rho =
(1 + sqrt(5))/2
f =
a*x^2 + b*x + c
A =
[ a, b, c]
[ c, a, b]
[ b, c, a]
A =
1.0000 0.2000
3.0000
0.5000
0.8000 0.1000
1.0000 0.6000
0.6000
A =
[ 1, 1/5, 3]
[ 1/2, 4/5, 1/10]
[ 1, 3/5, 3/5]
Task#
02
Matlab
Code:
syms a b n t x z
f = x^n; g = sin(a*t + b);
symvar (f)
symvar (g)
% Performing Symbolic
Computations
rho = sym('(1 +
sqrt(5))/2')
f=rho^2-rho-1
pretty(f)
f = 2*x^2 - 3*x + 1
subs(f,2)
f = sin(x)^2
diff(f)
z=diff(f,y)
%Solving Equations
eq1=sym('5*I1+6*I2
+8*I3=1')
eq2=sym('8*I1+6*I2
+2*I3=9')
eq3=sym('7*I1+4*I2
+1*I3=0')
I=solve(eq1,eq2,eq3)
I1=I.I1
I2=I.I2
I3=I.I3
Results:
(from the command window)
ans =
[ n, x]
ans =
[ a, b, t]
rho =
(1 +
sqrt(5))/2
f =
(5^(1/2)/2 +
1/2)^2 - 5^(1/2)/2 - 3/2
/
1/2 \2 1/2
| 5
| 5
| ---- + 1/2 | - ---- - 3/2
\
2 / 2
f =
2*x^2 - 3*x + 1
ans =
3
f =
sin(x)^2
ans =
2*cos(x)*sin(x)
z =
0
eq1 =
5*I1+6*I2 +8*I3=1
eq2 =
8*I1+6*I2 +2*I3=9
eq3 =
7*I1+4*I2 +1*I3=0
I =
I1: [1x1 sym]
I2: [1x1 sym]
I3: [1x1 sym]
I1 =
-116/27
I2 =
151/18
I3 =
-94/27
Task#
03
Matlab
Code:
L1=2;L2=3;L3=4;
C=1;
R1=1;R2=1;
syms s v1 I1 I2 I3
Z=[L1*s+R1+R2 -1*(1+L2*s)
-R1;
-1*(1+L2*s)
R1+(L1+L2+L3)*s -L3*s;
-R1 -L3*s R2+L3*s+1/(C*s)];
I=[I1;I2;I3]
V=sym([v1;0;0])
I= inv(Z)*V
I=simplify (I)
trans=I/v1
Results:
I =
I1
I2
I3
V =
v1
0
0
I =
(v1*(20*s^3 + 13*s^2 + 10*s + 1))/(4*s^4 +
9*s^3 + 10*s^2 + 14*s + 1)
(v1*(12*s^3 + 11*s^2 + 4*s + 1))/(4*s^4 +
9*s^3 + 10*s^2 + 14*s + 1)
(s*v1*(12*s + 1)*(s + 1))/(4*s^4 +
9*s^3 + 10*s^2 + 14*s + 1)
t =
(20*s^3 + 13*s^2 + 10*s + 1)/(4*s^4 + 9*s^3 +
10*s^2 + 14*s + 1)
(12*s^3 + 11*s^2 + 4*s + 1)/(4*s^4 + 9*s^3 +
10*s^2 + 14*s + 1)
(s*(12*s + 1)*(s + 1))/(4*s^4 + 9*s^3 +
10*s^2 + 14*s + 1)
Task#
04
Matlab Code:
syms F1 s K1 K2 K3 d3 m1 m2 m3 x1 x2 x3
% supposing valuse
m1=1; K1=1;
m2=1; K2=1;
m3=1; K3=1; d3=1;
M=[m1*s^2+K1 -K1 0;-K1
m2*s^2+K2+K1 -K2;0 -K2 m3*s^2+d3*s+K3+K2]
X=[x1;x2;x3];
F=[F1;0;0];
delta1=[F1 -K1 0;0 m2*s^2+K2+K1
-K2;0 -K2 m3*s^2+d3*s+K3+K2]
delta2=[m1*s^2+K1 F1 0;-K1 0
-K2;0 0 m3*s^2+d3*s+K3+K2];
delta3=[m1*s^2+K1 -K1 F1;-K1
m2*s^2+K2+K1 0;0 -K2 0];
x1=det(delta1)/det(M);
t1=x1/F1
t1=simplify(t1)
% sym2poly command is not
working
% taking numerator &
denomenator coefficients from the results
num=[0 0 1 1 4 2 3];
den=[1 1 5 3 6 1 1];
t1=tf(num,den)
I=impulse(t1);
figure(1)
plot(I);
title('Impulse
Response of the transfer function of X1');
grid on
U=step(t1);
figure(2)
plot(U);
title('step Response
of the transfer function of X1');
grid on
% for x2
x2=det(delta2)/det(M);
t2=x2/F1
t2=simplify(t2)
num=[0 0 0 0 1 1 2];
den=[1 1 5 3 6 1 1];
t2=tf(num,den)
I2=impulse(t2);
figure(3)
plot(I2);
title('Impulse
Response of the transfer function of X2');
grid on
U2=step(t2);
figure(4)
plot(U2);
title('step Response
of the transfer function of X2');
grid on
% for x3
x3=det(delta3)/det(M);
t3=x3/F1
t3=simplify(t3)
num=[0 0 0 0 0 0 1];
den=[1 1 5 3 6 1 1];
t3=tf(num,den)
I3=impulse(t3);
figure(5)
plot(I3);
title('Impulse
Response of the transfer function of X3');
grid on
U3=step(t3);
figure(6)
plot(U3);
title('step Response
of the transfer function of X3');
grid on
Results
Transfer function: X1/F1:
s^4 + s^3 + 4 s^2 + 2 s + 3
-----------------------------------------
s^6 + s^5 + 5 s^4 + 3 s^3 + 6 s^2 + s + 1
Transfer function:X2/F1
s^2 + s + 2
-----------------------------------------
s^6 + s^5 + 5 s^4 + 3 s^3 +
6 s^2 + s + 1
Transfer function:X3/F1
1
-----------------------------------------
s^6 + s^5 + 5 s^4 + 3 s^3 + 6 s^2 + s + 1
No comments:
Post a Comment