Assignment 2
Assignment 2
01
Assignment EC-1
T3
Submitted by
MOHAMMAD MASOOM ALI
2023HT30176
H
23
Birla Institute of Technology & Science, Pilani
20
Mohammad Masoom Ali Student ID: 2023HT30176
Question no. 1
76
𝑑2𝑦 𝑑𝑦 𝑑𝑦
Solution Given +2 − 3𝑦 = sin 𝑡 𝑠𝑢𝑏𝑗𝑒𝑐𝑡 𝑡𝑜 (0) = 0 & 𝑦(0) =0
𝑑𝑡 2 𝑑𝑡 𝑑𝑡
01
𝐿𝑦̇ = 𝑠𝑦(𝑠) − 𝑦(0) => 𝑠𝑦(𝑠)
1
Substituting in original equations we get 𝑠 2 𝑦(𝑠) + 2𝑠𝑦(𝑠) − 3𝑦(𝑠) = Simplifying further
𝑠 2 +1
1
𝑦(𝑠) =
T3
(𝑠 2 + 1)(𝑠 2 + 2𝑠 − 3)
1
=
(𝑠 2 + 1)(𝑠 − 1)(𝑠 + 3)
1 1
𝐶 = lim =
𝑠→−3 (𝑠 2 + 1)(𝑠 − 1) −40
20
1
Mohammad Masoom Ali Student ID: 2023HT30176
1 2 1
76
(𝑠 + 1)(𝑠 + 3) − (𝑠 2 + 1)(𝑠 − 1) + (𝐴𝑠 + 𝐵)(𝑠 − 1)(𝑠 + 3) = 1
8 40
1 3 1
(𝑠 + 𝑠 2 + 𝑠 + 3) − (𝑠 3 − 𝑠 2 + 𝑠 − 1) + (𝐴𝑠 3 + 2𝐴𝑠 2 − 3𝐴𝑠 + 𝐵𝑠 2 + 2𝐵𝑠 − 3𝐵) = 1
8 40
01
By comparing coefficient of 𝑠 3 both sides we get
1 1 1
− +𝐴=0 => 𝐴=
8 40 −10
Similarly by comparing coefficient of 𝑠 2 both sides we get
T3
3 1 1
− + 2𝐴 + 𝐵 = 0 => 𝐵=
8 40 −5
(𝑠+2)
Then 𝐴𝑠 + 𝐵 = − Substituting in above equation we get
10
H 𝑌(𝑠) =
1
−
1
−
(𝑠 + 2)
8(𝑠 − 1) 40(𝑠 + 3) 10(𝑠 2 + 1)
23
1 1 1 𝑠 2
𝑌(𝑠) = − − { 2 + 2 }
8(𝑠 − 1) 40(𝑠 + 3) 10 (𝑠 + 1) (𝑠 + 1)
𝟏 𝒕 𝟏 −𝟑𝒕 𝟏
𝒀(𝒔) = 𝒆 − 𝒆 − {𝐜𝐨𝐬 𝒕 + 𝐬𝐢𝐧 𝟐𝒕}
𝟖 𝟒𝟎 𝟏𝟎
20
2
Mohammad Masoom Ali Student ID: 2023HT30176
Question no. 2 Given 𝒙𝟏̇ = 𝟒𝒙𝟐𝟏 𝒙𝟐 + 𝟒�𝒙𝟐𝟏 + 𝟐𝒙𝟐𝟐 − 𝟒� & 𝒙𝟐̇ = −𝟐𝒙𝟑𝟏 − 𝟐�𝒙𝟐𝟏 + 𝟐𝒙𝟐𝟐 − 𝟒� + 𝒖
76
Solution 2.1 Verify for u=0 𝑥𝑥1 = 1 & 𝑥𝑥2 = 1 is at equilibrium
01
𝑥𝑥2̇ = −2(1) − 2(1 + 2(1) − 4) + 0 = 0
T3
𝑥𝑥1̇ = 𝑓1 (𝑥𝑥1 𝑥𝑥2 𝑢 𝑔) = 4𝑥𝑥12 𝑥𝑥2 + 4(𝑥𝑥12 + 2𝑥𝑥22 − 4)
𝜕𝑓2
= −6(1) − 4(1) = −10
𝜕𝑥𝑥1
20
𝜕𝑓2
= −8(1) = −8
𝜕𝑥𝑥2
3
Mohammad Masoom Ali Student ID: 2023HT30176
𝜕𝑓1 𝜕𝑓2
76
=0 & =1
𝜕𝑢 𝜕𝑢
01
𝐴=⎢ 1 =� �
⎢ 𝜕𝑓2 𝜕𝑓2 ⎥ −10 −8
⎣𝜕𝑥𝑥1 𝜕𝑥𝑥2 ⎦
𝜕𝑓1
0
𝐵 = � 𝜕𝑢 � = � �
T3
𝜕𝑓2 1
𝜕𝑢
𝟏𝟔 𝟐𝟎 𝒙𝟏 𝟎
𝑨𝒙 + 𝑩𝒖 = ∆𝒙̇ = � � �𝒙 � + � � [𝒖]
−𝟏𝟎 −𝟖 𝟐 𝟏
H
Question no. 3
𝑚𝐿2 𝜃̈ + 𝑐𝜃̇ + 𝑚𝑔𝐿𝑠𝑖𝑛𝜃 = 𝑢(𝑡) => 𝑚𝐿2 𝑥𝑥2̇ + 𝑐𝑥𝑥2 + 𝑚𝑔𝐿𝑠𝑖𝑛𝑥𝑥1 = 𝑢(𝑡)
4
Mohammad Masoom Ali Student ID: 2023HT30176
76
𝒄 𝒈 𝒖(𝒕)
𝒙𝟐̇ = − − 𝑺𝒊𝒏𝒙𝟏 +
𝒎𝑳𝟐 𝑳 𝒎𝑳𝟐
01
3.2 Since 𝑆𝑖𝑛𝑥𝑥1 term is present in the equation, state space model is non-linear and none of its constants are dependent
on time we can say it is time invariant.
T3
If 𝜃0 (𝑡) = 𝛺𝑡 then 𝑢(𝑡) = 𝑐𝛺 + 𝑚𝑔𝐿𝛺𝑡 Therefore
𝒖(𝒕) = 𝒄𝜴 + 𝒎𝒈𝑳𝜴𝒕
3.4 Linearize the state space model around the nominal solution found in 3.3 above
H We know
∆𝑥𝑥̇ 𝜕𝑥
𝜕𝑓1
� 1 � = � 𝜕𝑓1
∆𝑥𝑥̇ 2
𝜕𝑓1
𝜕𝑥2 ∆𝑥𝑥1
��
𝜕𝑓2 ∆𝑥𝑥
𝜕𝑓1
𝜕𝑢
� + �𝜕𝑓 �
23
2 2 2
𝜕𝑥1 𝜕𝑥2 𝜕𝑢
𝑐 𝑔 𝑢(𝑡)
𝑓2 (𝑥𝑥1 𝑥𝑥2 𝑢 𝑔) = 𝑥𝑥2̇ = − − 𝑆𝑖𝑛𝑥𝑥1 + Therefore,
𝑚𝐿2 𝑚𝐿2
20
5
Mohammad Masoom Ali Student ID: 2023HT30176
76
= 0; = 1; = 0.
𝜕𝑥𝑥1 𝜕𝑥𝑥2 𝜕𝑢
01
At equilibrium condition we get
𝟎 𝟏 𝟎
∆𝒙̇ 𝟏 −𝒈𝒄𝒐𝒔𝜴𝒕 𝒄 � �∆𝒙𝟏 � + � 𝟏 � [∆𝒖]
� �=�
∆𝒙̇ 𝟐 − ∆𝒙𝟐
𝒍 𝒎𝑳𝟐 𝒎𝒍𝟐
T3
𝜕𝑓2 −𝑔𝑐𝑜𝑠𝛺𝑡
3.5 Since = is function of t i.e. time we can say that it is time variant
𝜕𝑥1 𝑙
H
23
20
6
Mohammad Masoom Ali Student ID: 2023HT30176
Question no. 4 Obtain the response of the system 𝒙̇ = 𝑨𝒙, where 𝒙 = �𝒙𝟏� and 𝑨 = � 𝟎 𝟏 � given that 𝑥𝑥1(0) = 1, 𝑥𝑥2(0) = −1.
76
𝒙𝟐 −𝟑 −𝟐
Solution
01
1
Given 𝑥𝑥1 (0) = 1 𝑥𝑥2 (0) = −1 => 𝑥𝑥 = 𝑒 𝐴𝑡 � �………………………… eq. 1
−1
Now by performing Laplace transformation on 𝑒 𝐴𝑡 we get:
0 1 1 0
𝑒 𝐴𝑡 = 𝐿−1 [(𝑆𝐼 − 𝐴)−1 ] 𝑤ℎ𝑒𝑟𝑒 𝐴 = � � &𝐼 =� �
T3
−3 −2 0 1
𝑠 0 0 1 −1 𝑠 −1 −1
𝑒 𝐴𝑡 = 𝐿−1 ��� �−� �� � => 𝐿−1 ��� �� �
0 𝑠 −3 −2 3 𝑠+2
Now solution to inverse of above matrix as follows
�
𝑠+2 1
� 2
1
−3 𝑠 𝑠 + 2𝑠 + 3
23
𝑠+2 1
𝑠 2 +2𝑠+3 𝑠 2 +2𝑠+3
Therefore 𝐿−1 � −3 𝑠 � Now factorising 𝑠 2 + 2𝑠 + 3 as => (𝑠 + 1)2 + (√2)2
𝑠 2 +2𝑠+3 𝑠 2 +2𝑠+3
20
7
Mohammad Masoom Ali Student ID: 2023HT30176
𝑠+2 1
76
(𝑠+1)2 +(√2)2 (𝑠+1)2 +(√2)2
Now substituting above values we get 𝐿−1 � −3 𝑠 �
(𝑠+1)2 +(√2)2 (𝑠+1)2 +(√2)2
01
⎡ (𝑠 + 1) + (√2) √2
( ) ⎤
⎢ √2 √2 ⎥
⎢ 2 2 (𝑠 + 1) + (√2) ⎥
2 2
𝐿−1 ⎢(𝑠 + 1) + (√2) ⎥
⎢ −3√2 𝑠 ⎥
⎢ √2 ⎥
T3
⎣(𝑠 + 1)2 + (√2)2 2 2
(𝑠 + 1) + (√2) ⎦
1 𝑡 1
⎡𝑒 −𝑡 𝑐𝑜𝑠√2𝑡 + 𝑒 𝑠𝑖𝑛√2𝑡 𝑒 −𝑡 𝑠𝑖𝑛√2𝑡 ⎤
𝑒 𝐴𝑡 =⎢ √2 √2 ⎥
H ⎢
⎣
−3 −𝑡
√2
𝑒 𝑠𝑖𝑛√2𝑡 𝑒 −𝑡 𝑐𝑜𝑠√2𝑡 −
1
1
√2
𝑒 −𝑡 𝑠𝑖𝑛√2𝑡⎥
⎦
1
23
𝑒 −𝑡 𝑐𝑜𝑠√2𝑡 + 𝑒 𝑡 𝑠𝑖𝑛√2𝑡 𝑒 −𝑡 𝑠𝑖𝑛√2𝑡 1
√2 √2
Now substituting this value in eq. no. 1 we get 𝑥𝑥 = � −3 −𝑡 1 �� �
𝑒 𝑠𝑖𝑛√2𝑡 𝑒 −𝑡 𝑐𝑜𝑠√2𝑡 − 𝑒 −𝑡 𝑠𝑖𝑛√2𝑡 −1
√2 √2
𝒆−𝒕 𝒄𝒐𝒔√𝟐𝒕
Solving we get: 𝒙=� �
−√𝟐𝒆−𝒕 𝒔𝒊𝒏√𝟐𝒕 − 𝒆−𝒕 𝒄𝒐𝒔√𝟐𝒕
20
8
Mohammad Masoom Ali Student ID: 2023HT30176
Question no. 5
76
Solution 5.1 MATLAB code for single trial is attached here
Computed probability is 0
01
T3
H
23
20
9
Mohammad Masoom Ali Student ID: 2023HT30176
5.2 Given increase the no. of trial to 100000 and rerun the program
76
Computed probability = 0.1187
01
T3
H
23
20
10
Mohammad Masoom Ali Student ID: 2023HT30176
76
Computed probability = 0.4114
01
T3
H
23
20
11
Mohammad Masoom Ali Student ID: 2023HT30176
76
Exact solution
1
Chances of 2 people sharing same birthday would be =
365
01
Out of 10 people in a group 2 the selected so the combination would be 102𝐶 = 45
𝟏
Probability = ( )𝟒𝟓 = 𝟎. 𝟏𝟏𝟔𝟐
𝟑𝟔𝟓
𝟏 𝟐𝟎
Similarly for group of 20 people probability = ( ) 𝟐𝑪 = 𝟎. 𝟒𝟎𝟔𝟑
𝟑𝟔𝟓
T3
Clearly the result computed in MATLAB and exact solutions are in similar & in close range.
Also it can be deduced that probability of sharing a birthday significantly increases with increase in no.
H
23
20
12
Mohammad Masoom Ali Student ID: 2023HT30176
Question no. 6
76
Solution: For 6.1 MATLAB code is as follows:
01
T3
H
23
20
13
Mohammad Masoom Ali Student ID: 2023HT30176
6.2
76
0.5
Estimated PDF of X
0.45 Gaussian PDF of X
01
0.4
0.35
0.3
0.25
PDF
T3
0.2
0.15
0.1
H 0.05
0
-6 -4 -2 0
X
2 4 6
23
20
14
Mohammad Masoom Ali Student ID: 2023HT30176
76
X -0.2
0.4 Y 0.391043
Value 0.396633
01
Bin edges [0.03 0.06]
0.35
0.3
T3
0.25
PDF
0.2
0.15
H 0.1
23
0.05
-4 -2 0 2 4 6
X
20
15
Mohammad Masoom Ali Student ID: 2023HT30176
Question no. 7
76
Solution: For 7.1
01
T3
H
23
Clearly given X1 & X2 random values are plotted within a fixed band i.e. a parallelogram and are dependent on
each other. Such a random number would always lie in a certain interval.
20
16
Mohammad Masoom Ali Student ID: 2023HT30176
76
𝑦1 1 0
Express the given relationship in vector form as: � � = 𝑋1 � � + 𝑋2 � � i.e.; as a linear combination of two constant
𝑦2 1 1
vectors. Note that 0<𝑋1 & 𝑋2 <1. Clearly if 𝑋1 𝑉𝑠 𝑋2 is plotted and it result in uniform distribution of points then it can be
said that both 𝑋1 & 𝑋2 are independent.
01
But if the plot is in fixed interval then 𝑋1 & 𝑋2 are both dependent variables.
T3
H
23
20
17
Mohammad Masoom Ali Student ID: 2023HT30176
Question No. 8
76
Solution Given 95% is at least good product and other 5% is defective parts
01
Applying binomial probability law total no. of possibilities of accepting goods we get:
100
95𝐶∗ 0.9495 ∗ 0.065 + 100 96 4 100 97 3 100 98 2 100 99
96𝐶 ∗ 0.94 ∗ 0.06 + 97𝐶 ∗ 0.94 ∗ 0.06 + 98𝐶 ∗ 0.94 ∗ 0.06 + 99𝐶 ∗ 0.94 ∗
0.061 + 100
100𝐶 ∗ 0.94
100
= 𝟎. 𝟒𝟒𝟎𝟕
T3
Probability of rejecting goods = 𝟎. 𝟓𝟓𝟗𝟑
H
Good parts = 950 Defective parts = 50
Applying binomial probability law total no. of possibilities of accepting goods we get:
23
100
95𝐶∗ 0.9595 ∗ 0.055 + 100 96 4 100 97 3 100 98 2 100 99
96𝐶 ∗ 0.95 ∗ 0.05 + 97𝐶 ∗ 0.95 ∗ 0.05 + 98𝐶 ∗ 0.95 ∗ 0.05 + 99𝐶 ∗ 0.95 ∗
0.051 + 100
100𝐶 ∗ 0.95
100
= 𝟎. 𝟔𝟏𝟔𝟎
18
Mohammad Masoom Ali Student ID: 2023HT30176
76
Total no. of parts = 1000
Applying binomial probability law total no. of possibilities of accepting goods we get:
01
100
98𝐶 ∗ 0.9598 ∗ 0.052 + 100 99 1 100
99𝐶 ∗ 0.95 ∗ 0.05 + 100𝐶 ∗ 0.95
100
= 𝟎. 𝟏𝟏𝟖𝟑
T3
H
23
20
19
Mohammad Masoom Ali Student ID: 2023HT30176
76
01
T3
H
23
20
20
Mohammad Masoom Ali Student ID: 2023HT30176
76
01
T3
H
23
20
21
Mohammad Masoom Ali Student ID: 2023HT30176
76
01
T3
H
23
20
22
Mohammad Masoom Ali Student ID: 2023HT30176
Question No. 9
76
Solution
Given coin tossed 10 times chances of getting exactly 5 heads are as follow:
01
Probability of tail = 0.5
𝟏 𝟓 𝟏 𝟓 𝟐𝟓𝟐
P (head = 5) = 𝟏𝟎𝟓𝑪 ∗ � � ∗ � � = = 0.2460
𝟐 𝟐 𝟏𝟎𝟐𝟒
T3
The above result is verified using MATLAB as follows:
H
23
20
23
Mohammad Masoom Ali Student ID: 2023HT30176
76
01
T3
H
23
20
24