Labtask 2
Labtask 2
1. g(t)= sin(t)
2. g(t)= t ^2
3. g(t)= e ^at
4. g(t) 5te^5t
Solution
1.1)
clc
close all
clear all
syms w t
y = sin(w*t)
t=y
laplace(t)
1.2)
syms t
y = t^2
t=y
laplace(t)
ans =2/s^3
1.3)
syms a t
y = exp(a*t);
t=y;
laplace(t)
ans = -1/(a - s)
1.4)
syms t
y = 5*exp(-5*t);
t=y;
laplace(t)
ans =5/(s + 5)
1.5)
syms t
y = 2*exp(-2*t)*sin(2*t);
t=y;
laplace(t)
conclusion ;
In this task,we get laplace transform of the funcitons by using command ‘laplace’ ,
TASK 2 :
: Find Inverse Laplace transform following time domain signals
2.1)
syms s
g=(5s+3)/(s+2)(s+3)
ilaplace(g)
2.2)
syms s
g=1/s*(s+2);
ilaplace(g)
ans =dirac(t) + 2
2.3)
syms s
g=100*(s+2)/(s+2)*(s+3);
ilaplace(g)
2.4)
syms s
g=(s+3)/(s^2)+(5*s+2);
ilaplace(g)
2.5)
syms s
g=(4*s^2+16*s+12)/(s^3+44*s^2+48*s+12);
ilaplace(g)
ans =4*sum((exp(root(s3^3 + 44*s3^2 + 48*s3 + 12, s3, k)*t)*root(s3^3 + 44*s3^2 + 48*s3 + 12, s3,
k)^2)/(3*root(s3^3 + 44*s3^2 + 48*s3 + 12, s3, k)^2 + 88*root(s3^3 + 44*s3^2 + 48*s3 + 12, s3, k) +
48), k, 1, 3) + 12*sum(exp(root(s3^3 + 44*s3^2 + 48*s3 + 12, s3, k)*t)/(3*root(s3^3 + 44*s3^2 + 48*s3
+ 12, s3, k)^2 + 88*root(s3^3 + 44*s3^2 + 48*s3 + 12, s3, k) + 48), k, 1, 3) + 16*sum((root(s3^3 +
44*s3^2 + 48*s3 + 12, s3, k)*exp(root(s3^3 + 44*s3^2 + 48*s3 + 12, s3, k)*t))/(88*root(s3^3 + 44*s3^2
+ 48*s3 + 12, s3, k) + 3*root(s3^3 + 44*s3^2 + 48*s3 + 12, s3, k)^2 + 48), k, 1, 3)
CONCLUSION :
In this task,we get inverse laplace transform of the laplace funcitons by using command ‘ilaplace’ ,
TASK 3 :
Find partial fraction with residue command
3.1)
2
s + 3 s+ 1
3
(s +1)
N=[1 3 1];
D=[1 3 3 1];
[R,P,K]=residue(N,D);
Result :
R=
1.0000
1.0000
-1.0000
P=
-1.0000
-1.0000
-1.0000
K=
[]
Ans
2
s + 3 s+ 1 1 1 1
3
= + −
(s +1) s+1 s+1 s+1
3.2)
3 2
23 s + 28 s +25 s+3
3 2
s + 16 s + 8 s+ 2
N=[23 28 35 3]
D=[1 16 8 2]
[R,P,K]=residue(N,D)
Result
R=
0.0079 + 0.0065i
0.0079 - 0.0065i
P=
-15.4919 + 0.0000i
-0.2540 + 0.2541i
-0.2540 - 0.2541i
K = 23
Ans
3 2
23 s + 28 s +25 s+3 1.0e+02∗(−3.4158+ 0.0000 i) 0.0079+1.0065i 0.0079−0.0065 i
= + +
3 2
s + 16 s + 8 s+ 2 s +15.4919−0.0000i s+0.2540−0.2541 i s +−0.2540+0.2541 i
+23
3.3)
2
4 s + 16 s +12
4 3 2
s +12 s +44 s + 48
N=[4 16 12]
D=[1 12 44 48]
[R,P,K]=residue(N,D)
Result
R=
7.5000
-3.0000
-0.5000
P=
-6.0000
-4.0000
-2.0000
K = []
ans
2
4 s + 16 s +12 7.5 3 0.5
= − −
s +12 s +44 s + 48 s +6 s +4 s+ 2
4 3 2
CONCLUSION
In his task,we used command ‘residue’ to check the partial fraction of the function whether it is
improper or proper function
TASK 4 :
: Analyze VC for 10V, 5V and 3V input voltage. And write about changes in output. L = 1/4 H, C = 4/3 F
and R = 1Ω.
Solution :
>> syms s
>> N=3
>> D=[1 4 3]
>> g=tf(N,D)
g= -------------
s^2 + 4 s + 3
a) 1 VOLT
Step(g)
GRAPH
Step Response
1
0.9
0.8
0.7
0.6
Amplitude
0.5
0.4
0.3
0.2
0.1
0
0 1 2 3 4 5 6 7
Time (seconds)
figure 4(a)
b) 3 VOLTS
Step(3*g)
Step Response
3
2.5
2
Amplitude
1.5
0.5
0
0 1 2 3 4 5 6 7
Time (seconds)
figure 4(b)
5 VOLTS
Step(5*g):
Step Response
5
4.5
3.5
3
Amplitude
2.5
1.5
0.5
0
0 1 2 3 4 5 6 7
Time (seconds)
Figure 4(c)
10 VOLTS
Step(10*g)
Step Response
10
6
Amplitude
0
0 1 2 3 4 5 6 7
Time (seconds)
Figure 4(d)
CONCLUSION :
In this task we used transfer function of an electrical circuit and changed the amplitude of input to get
the different outputs
TASK 5 :
SIMULINK where M = 1.2, 𝑓v = 3 and K = 5.
Now students have to simulate and plot the step response of the system using script file and
Solution
N=1
D=[1.2 3 5]
g=tf(N,D)
g=
-----------------
1.2 s^2 + 3 s + 5
Step(g)
GRAPH
Step Response
0.25
0.2
0.15
Amplitude
0.1
0.05
0
0 0.5 1 1.5 2 2.5 3 3.5 4
Time (seconds)
Figure 5(a)
SIMULINK;
In this task we used transfer function of an mechanical circuit and changed the amplitude of input to get
the different outputs
OUTPUT :
0.25
0.2
0.15
0.1
0.05
0
0 1 2 3 4 5 6 7 8 9 10
TASK 6 :
Using Matlab find the transfer function G(s)=Vo(s)/Vi(s). Use mesh equations and find transfer
function
Solution :
Mesh equations :
Mesh 1 :
Vi(t)=1(i1-i3)+1(i1-i2)+2s(i1-12)
Vi(t)=(2+2s)i1+(-1-2s)i2-i3 ---------eq(1)
Mesh 2 ;
0=2s(i2-i1)+1(i2-i1)+2(i2-i3)+3s(i2-i3)+4i2
0=(-1-2s)i1+(7+5s)i2+(-2-3s)i3 ------------eq(2)
Mesh 3 :
0=1(i3-i1)+(1/5s)(i3)+3s(i3-i2) + 2(i3-i2)
V=ZI
0 [ -1 , - 3*s - 2, (16*s)/5 + 3] i3
I=invs(Z) * V
a=inv(z)
I=a*V
I3=I(3)
Voltage on capacitor is
Vo=i3*(1/5*s)
Transfer function is
CONCLUSION :
In this task we find output voltage of capacitor to get the transfer funvtion of the system using matlab
coding,