Professional Documents
Culture Documents
MATLAB/PSPICE SIMULATION
LAB NAME:
STUDENT NAME:
GROUP NO:
DATE OF SUBMISSION:
INSTRUCTORS NAME:
1
Objective:
To get Familiarize with PSPICE & MATLAB in designing of RLC & Op-Amp circuit to check their Future
responses at different values of parameters. Observe Importance of Transfer function & working in
s domain for easiness. Lastly, Configured convolution importance for given signals & check their
output for fulfilling requirements etc.
Simulations: PSpice
1. In PSpice, use a VPULSE1 voltage source to create the periodic signal vg(t) as shown in Figure 1b
and apply it to the series RLC circuit in Figure 1a. Perform a Parametric Sweep to plot v(t) for t
> 0 when R = 750Ω, R = 1250Ω, and R = 1500Ω. Please see the Appendix on how to run a
Parametric Sweep. Include vg(t) in the plot along with v(t) for all three cases of R. Assume that
v(0) = 0V and i(0) = 0A.
R 62.5mH
+
i (t)
v g (t ) 160nF v (t)
(a )
vg (t)( V )
t (ms)
0 2.5 5 7.5 10 12.5
(b )
Solution:
2
3
RESULTS:
From above figure It could be seen that as we Increase resistance of circuit pulses in systems become
stable with respect to reference point etc.
2. Use PSpice to find Io and Vo in the circuit below.
GIVEN CICUIT
𝑣 = 10𝑐𝑜𝑠𝐶103 + 3𝑣
Here voltage is connected to sin from cos
Therefore
𝑣 = 10𝑐𝑜𝑠𝐶103 + 1
𝑣 = 10𝐿−90
𝜔 = 103 𝑟𝑎𝑑⁄𝑠𝑒𝑐
4
𝑉𝐵 − 𝑉𝐴 𝑉𝐵
+ 𝐻𝑖𝑜 + =0
𝑍𝑐 30 + 𝑍𝐿
−𝑗
𝑍𝑐 = , 𝑍𝐿 = 𝐽𝑥𝑙
𝑋𝑐
1 1 1
𝑋𝑐 = = =
2𝜋𝑓𝑐 𝜔𝑐 103 𝑥50𝑥10−6
1 1000
𝑋𝑐 = −3
= =2
50𝑥10 50
𝑋𝑐 = 2𝜋
Now
At Node A
𝑉𝐴 − 𝑉 𝑉𝐴 (𝑉𝐴 − 𝑉𝐵 )2
+ + =0
20 20 −𝑗
𝑉𝐴 −10𝐿−90 𝑉
20
+ 20𝐴 + 𝑗2(𝑉𝐴 − 𝑉𝐵 ) = 0 ------------------------1
At node B
𝑉𝐵 − 𝑉𝐴 𝑉𝐵
+ 𝐻𝑖𝑜 + =0
𝑍𝑐 30 + 𝑍𝐿
𝑉𝐴
But here the value of 𝑖0 = 20
𝑉𝐵 − 𝑉𝐴 4𝑉𝐴 𝑉𝐵
+ + =0
𝑍𝑐 20 30 + 𝑗10
4𝑉𝐴 𝑉
(𝑉𝐴 − 𝑉𝐵 )𝑗2 =
20
𝐵
+ 30+𝑗10 = 0 ----------------------2
5
𝑉𝐴 [2 + 𝑗ℎ𝑜] − 𝑉𝐵 = −10𝑗[−𝑗ℎ𝑜]=-10j ----------------------- (3)
𝑉𝐵
4𝑉𝐴 + + 2𝑗(𝑉𝐴 − 𝑉𝐵 ) = 0
30 + 𝑗10
120𝑉𝐴 + 40𝑗𝑉𝐴 + 𝑉𝐵 + (60𝑗 − 40)(𝑉𝐴 − 𝑉𝐵 ) = 0
120𝑉𝐴 + 40𝑗𝑉𝐴 + 𝑉𝐵 + 40𝑉𝐴 − 60𝑗𝑉𝐴 − 40𝑉𝐵 + 60𝑗𝑉𝐵 = 0
𝑉𝐴 [160 − 20𝑗] + 𝑉𝐵 [−39 + 60𝑗] = 0------------------ (4)
6
Now
0.087+0.1𝑗
Io=
20
Io=(0.000435+0.05j)A
In Rectangular form
Io=4.39x10−5Amp
Io=0.44 ma =>Magnitude
Now
𝑉0 = 𝐼30 𝑥30𝑜𝑚𝑒𝑔𝑎
𝑉𝐵
𝐼30 =
(30 + 𝑗𝑖𝑜)𝑜𝑚𝑒𝑔𝑎
𝑉𝐵
𝐼30 = 𝑥30
(30 + 𝑗𝑖𝑜)
We get
𝑉𝐴 (2 + 𝑗ℎ𝑜) + 10𝑖
𝑉𝐵 =
40𝑗
(0.087 + 0.1𝑗)[2 + 𝑗ℎ𝑜 + 10𝑗]
𝑉𝐵 =
40𝑗
𝑉𝐵 = −0.073 + 0.12𝑗
(0.6 + 0.12𝑗)(30)
𝑉0 =
30 + 𝑗10
𝑉0 = 4.8𝐿350
𝑉0 = 4.8𝐿350 V01+5
3. Use PSpice to find Vo in the circuit shown below. Let
7
FIGURE 3
Solution:
Given circuit
𝑣32 = 160cos(100𝑡)
w=100, round/sec
𝑋𝐿1 = 𝑗𝑊𝐿1
𝑋𝐿1= j(100)(300x10−3 )
𝑋𝐿1 = 30𝑗
𝑋𝐿2 = 𝑗𝑊𝐿2
𝑋𝐿2=j(100)(400x10−3 )
8
𝑋𝐿3 = j(100)(200m)
𝑋𝐿3 = 20𝑗
1
𝑋𝑐 =
𝑗𝑤𝑐
1
𝑋𝑐 = = 20𝑗
𝑗(100)(50𝑥106 )
𝑉𝑎 − 𝑉𝑏 𝑉𝑏 𝑉𝑏 − 160
+ + =0
40𝑗 −20𝑗 (10 + 20𝑗)
9
4. Use PSpice to find the magnitude response |H(jω)| and the phase response H(jω)◦ in the
circuit shown below. Use the generic OPAMP part under the ANALOG.OLB library.
Solution:
10
Simulation Waveform:
Simulations: MATLAB
5. The operational amplifier in the circuit in Figure 5 is ideal and is operating within its linear
region.
11
10nF
250nF
10 kΩ 100kΩ
+
vi +
20 kΩ vo
−
Figure 5
𝑉𝑖 𝑠 − 𝑜 𝑉𝑖 𝑠 − 𝑜
9 =
10 10𝑘 + 109
10𝑘 +
250𝑠 1000𝑘𝑠 + 109
𝑉0 𝑠
𝑇(𝑠) =
𝑉𝑖 𝑠
100𝑘𝑥109
𝑉0 𝑠 −( )
= 1000𝑘𝑠 + 109
𝑉𝑖 𝑠 250𝑠𝑥1014 + 109
−( )
250𝑠
𝑉0 𝑠 −108 250𝑠
= 𝑥
𝑉𝑖 𝑠 𝑠 + 10 250𝑥104 (𝑆 + 400)
3
𝑉0 𝑠 −108 𝑥104 − 𝑠
=
𝑉𝑖 𝑠 (𝑠 + 1000)(𝑠 + 400)
12
𝑉0 𝑠 104 𝑠
=
𝑉𝑖 𝑠 (𝑠 + 1000)(𝑠 + 400)
𝑉0 (𝑡) if 𝑉𝑖 =𝜇(𝑡)
1
𝑉𝑖 (𝑠) =
𝑠
−104
𝑉0 (𝑠) =
(𝑠 + 1000)(𝑠 + 400)
Next step to get Partial Function
−50/3 50/3
𝑉0 (𝑠) = +
(𝑠 + 400) (𝑠 + 1000)
1 1
𝑉0 (𝑠) = 50/3 [ − ]
(𝑠 + 1000) (𝑠 + 400)
𝑉0 (𝑠) = 50/3[𝑒 −1000𝑡 − 𝑒 −400𝑡 ]
𝑉0 (𝑡) if 𝑉𝑖 =𝑟(𝑡)
1
−104 𝑠( 𝑠 ) −104
𝑉0 (𝑠) = =
(𝑠 + 400)(𝑠 + 1000) 𝑠(𝑠 + 400)(𝑠 + 1000)
Get Potential Fractions
1 1 1
(40) ( ) (60) −104
𝑉0 (𝑠) = + 24 − =
𝑠 𝑠 + 400 𝑠 + 1000 𝑠(𝑠 + 400)(𝑠 + 1000)
1 1 1
𝑉0 (𝑡) = − 40 𝑢(𝑡) + 24 𝑒 −400𝑡 − 60 𝑒 −1000𝑡
d)𝑽𝒊 = 𝟐𝒄𝒐𝒔𝒘𝒕𝑽
𝑽𝟎 (𝒕) =?
13
−104 𝑗𝑤
𝐻(𝑗𝑤) =
(𝑗𝑤 + 400)(𝑗𝑤 + 1000)
−104 𝑗𝑤
|𝐻(𝑗𝑤)| =
√𝑤 2 + (400)2 √𝑤 2 + (1000)2
𝑤
|𝐻(𝑗𝑤)| = −90 − tan−1
400
W=100
104 𝑤 ∗ 2 𝑤 𝑤
𝑉0 (𝑡) = cos(𝑤𝑡 − 90 − tan−1 ( ) − tan−1( )
√𝑤 2 + (400)2 √𝑤 2 + (1000)2 400 1000
𝑤
104 ∗ 100 ∗ 2 −1
𝑤 −1 ( ) ,𝑤 = 100
𝑉0 (𝑡) = cos(𝑤𝑡 − 90 − tan ( ) − tan 1000
√1002 + (400)2 √1002 + (1000)2 400
x(t) h(t)
t
1
14
t
0 1 0 1
a) Find y(t)= x(t)*h(t).
Hence,
Y (t) = 0, −∞ < t < 0.
15
Calculate the value of y(t) for 0<t<1.
𝑡
y(t) = ∫ (t − λ)(1)dλ
0
𝑡 𝑡
y(t) = t ∫ dλ − ∫ λdλ
0 0
𝑡
t[λ2 ]0 𝑡2 𝑡2
y(t) = t[λ]𝑡0 − = 𝑡2 − =
2 2 2
For 1<t<2 the two signals will overlap b/w 0 to 1 via t-1.
1
y(t) = ∫ ℎ(t − λ)x(λ)
0
𝑡−1 1
y(t) = ∫ ℎ(t − λ)x(λ)dλ + ∫ ℎ(t − λ)x(λ)dλ
0 𝑡−1
𝑡−1 1
y(t) = ∫ (1)(1)dλ + ∫ (𝑡 − λ)(1)dλ
0 𝑡−1
16
𝑡−1 1 1
y(t) = ∫ dλ + t ∫ dλ − ∫ λdλ
0 𝑡−1 𝑡−1
[λ2 ]1𝑡−1
y(t) = [λ]𝑡−1
0 + 𝑡[λ]1𝑡−1 −
2
1 − ( 𝑡 − 1) 2
y(t) = t − 1 + t[1 − (t − 1)] −
2
2𝑡 − 𝑡2
y(t) = t − 1 + 2t − t 2 −
2
2
𝑡2
y(t) = −t + + 3𝑡 − 𝑡 − 𝑡
2
𝑡2
y(t) = − + 2𝑡 − 1
2
For 2 < 𝑡 < ∞, the two signals will overlap between 0 to 1.
1
y(t) = ∫ (1)(1) 𝑑λ
0
1
y(t) = ∫ 𝑑λ = [λ]10 = 1
0
Therefore,
17
0, − ∞ < 𝑡 < 0
𝑡2
,0 < 𝑡 < 1,
2
y (t ) =
𝑡2
− + 2𝑡 − 1, 1 < 𝑡 < 2,
2
{1,2 < 𝑡 < ∞
h (t )
x (t) 2
2e− t
1
t t
0 0
(b )
Hence,
Y (t) = 0, −∞ < t < 0.
𝑡
y(t) = ∫ ℎ(t − λ)𝑥(λ)dλ
0
𝑡
y(t) = ∫ (2𝑒 −(𝑡−λ) )(1)dλ
0
𝑡
y(t) = 2 ∫ 𝑒 −(𝑡−λ) dλ
0
𝑡
[𝑒 −(𝑡−λ) ]0
y(t) = 2
−(−1)
Therefore,
19
0, − ∞ < 𝑡 < 0,
y (t ) = { [
2 1 − e−t ],0 < 𝑡 < ∞.
7. Obtain the convolution of the pairs of signals in Figure 7.
x(t) h(t)
1 1
t 0 t
0 1 1 2
−1
(a )
x(t) h(t)
Solution:
From figure 1, x [t-λ] & h(λ) overlaps in the interval 0<t<1 as follows
Figure 1
y(t) = [λ]𝑡0
y(t) = t
From figure 2, x(𝑡 − λ) & ℎ(λ) overlap in the Intervals 1<t<2 as follows
20
Figure 2
y(t) = 3 − 2t
From figure 3, x(𝑡 − λ) & ℎ(λ) overlap in the Intervals 2<t<3 as follows
Figure 3
21
2
y(t) = ∫ (1)(−1)dλ
𝑡−1
y(t) = [−λ]2𝑡−1
y (t ) = t − 3
Hence,
𝑡0 < 𝑡 < 1
3 − 2𝑡,1 < 𝑡 < 2,
y(t) = {
𝑡 − 32 < 𝑡 < 3,
0𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
t
1
t
0 1 0 1 2 3 4 5
(b)
Solution:
Determine 𝑓1 (𝑡)
1−0
𝑓1 (𝑡) − 0 = (𝑡 − 0)
1−0
𝑓1 (𝑡) = 𝑡
𝑓1 (𝑡 − λ) = 𝑡 − λ
For t<2 there is no overlap between 𝑓1 (𝑡 − λ) & 𝑓2 (λ)
So, y(t) = 0
22
From Figure 4, 𝑓1 (𝑡 − λ) & 𝑓2 (λ)overlaps in the Interval 2<t<3 as follows
Figure 4
𝑡
y(t) = ∫ (𝑡 − λ). (1)dλ
2
𝑡
λ2
( )
y t = [λ𝑡 − ]
2 2
t2 2
y(t) = [𝑡 − − (2𝑡 − 2)]
2
t2
y(t) = [ − 2𝑡 + 2)]
2
FIGURE 5
23
Calculate y(t) in the interval 3<t<5
𝑡
y(t) = ∫ 𝑓1 (𝑡 − λ). 𝑓2 (λ)dλ
𝑡−1
𝑡
y(t) = ∫ (𝑡 − λ). (1)dλ
𝑡−1
𝑡
λ2
( )
y t = [λ𝑡 − ]
2 𝑡−1
1
y (t ) =
2
From Figure 6, 𝑓1 (𝑡 − λ) & 𝑓2 (λ)overlaps in the Interval 5<t<6 as follows
Figure 6
5
y(t) = ∫ (𝑡 − λ). (1)dλ
𝑡−1
5
λ2
y(t) = [λ𝑡 − ]
2 𝑡−1
24
t2
y (t ) = − + 5𝑡 − 12
2
0,𝑡 < 2
𝑡2
− 2𝑡 + 2,2 < 𝑡 < 3,
2
1
y (t ) = 3 < 𝑡 < 5
2
𝑡2
− + 5𝑡 − 125 < 𝑡 < 6,
2
{0𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
8. Let x(t) and h(t) be as shown below. Find y(t) = x(t) ∗ h(t).
h(t)
4
x(t) 0 t
2 4 6 8 10
2
t −4
0 2 4 6
Figure8
Solution:
Lets Fold X(t) and slide on y(t) . For t>0 no overlapping occur as shown below
x(t)=0.
2 𝑡
𝑧(𝑡) = ∫ (2)(4)𝑑λ + ∫ (2)(−4)𝑑λ = 16 − 8𝑡
0 0
26
2 6 𝑡
𝑧(𝑡) = ∫ (2)(4)𝑑λ + ∫ (2)(−4)𝑑λ + ∫ (2)(4)𝑑λ
𝑡−6 2 6
2 6 𝑡
𝑧(𝑡) = 8λ | − 8λ | + 8λ | = −16
𝑡−6 2 6
6 8
𝑧(𝑡) = ∫ (2)(−4)𝑑λ + ∫ (2)(4)𝑑λ
𝑡−6 6
6 8
𝑧(𝑡) = −8λ | + 8λ | = 8𝑡 − 80
𝑡−6 6
27
8
𝑧(𝑡) = ∫ (2)(4)𝑑λ
𝑡−6
8
𝑧(𝑡) = 8λ | = 112 − 8𝑡
𝑡−6
Hence,
vs(t)
3V
t [s ]
0 1
(a )
28
1Ω
+
v s (t ) 1F 2Ω vo (t)
−
(b )
(a) Find the Laplace Transform of the voltage shown in Figure 9a.
(b) Using that value of vs(t) in the circuit shown in Figure Figure 9b, find the value of vo(t).
Solution:
Figure 1:
A) According to above graphs if we subtract graph 2 from graph 1 than we get graph given in
figure 1. As
𝑉𝑠 (𝑡 ) = 3𝑢(𝑡 ) − 3𝑢(𝑡 − 1)________(𝑖)
B taking Inverse Laplace Transform of figure given in equation I we get.
29
3 3𝑒 −𝑠
𝑉𝑠 (𝑡 ) = − ________(𝑖𝑖)
𝑠 𝑠
Appling Kirchhoff current law at node 1 of Figure 9(b). As all current are taken
outgoing. So, outgoing currents value will be positive & Vice versa.
Calculating Vo(t) . From node Voltages
[𝑉𝑜(𝑡 ) − 𝑉𝑠(𝑡 )] 𝑉𝑜(𝑡 ) 𝑉𝑜(𝑡 )
+ + =0
1 2 𝑋𝑐
1
𝑉𝑜(𝑡 ) [1 + + 𝑗𝑤] = 𝑉𝑠(𝑡)
2
[𝟑𝒖(𝒕) − 𝟑𝒖(𝒕 − 𝟏)]
𝑽𝒐(𝒕) =
𝟏 + 𝟎. 𝟓 + 𝒋𝒘
Analysis:
From the above PSpice simulation. It could be seen that for given RLS
circuit as we change an of parameters like R, C or L response of output voltages get
changed according to its reference level towards stability. From 2nd solution by use of
Transfer function relation & KCL & KVL we get values of Io & Vo with respect to time.
Next according to Solution of question 4 we successful draw magnitude & phase
response of transfer function for the given values of Input & results are added below.
From MATLAB portion b use of convolution relation step by step multiplied signal &
received inverted output. Also check response of output voltages at different value of
omega etc.
Conclusion:
After performing this assignment I learned about importance of simulation results for
PSPICE & MATLAB. I learned that in case of simulation we can get an unknown
parameter present in circuit particularly voltages & current. I learned at various input
30
to simulation circuit its output response would differ. In case of MATLAB if properly
signals are given in discrete form we can check their response by their default
MATLAB function etc.
Appendix
Example For the source-free parallel RLC circuit shown below, perform a Parametric Sweep to plot
v(t) for t > 0, assuming v(0) = 5V, i(0) = 0A. Consider these cases: R = 1.923Ω, R = 5Ω, and R = 6.25Ω.
v(t)
+ +
+
R v 1H v I 0 10 mF V0
−
− −
Figure10
CMAX
L5
R7 1H C4
1k 10m
IC = 0A IC = 5V
Figure 11
Next, change the resistor value from 1kΩ to {Rvar} as shown below:
CMAX
L5
R7 1H C4
{Rvar } 10m
IC = 0A IC = 5V
31
0
Figure 12
The next step is to place a part named PARAM from the SPECIAL.OLB library:
PARAMETERS:
CMAX
L5
R7 1H C4
{Rvar } 10m
IC = 0A IC = 5V
Figure 13
Select and double-click on PARAMETERS. This will open the Property Editor tab.
Figure 14
Click on New Property, and under Name, type Rvar. Under Value you need to type any resistor value,
therefore simply type 1k. Click OK.
32
Figure 15
The New Property will be added in alphabetical order, thus simply scroll to the right to locate your
new added property Rvar. Once the property is located, select it, and hit right-click. Then select
Display.
Figure 16
Figure 17
Now, go back to your schematic. We can see that the Rvar is now present.
PARAMETERS:
Rvar = 1k
CMAX
L5
R7 1H C4
{Rvar } 10m
IC = 0A IC = 5V
33
Figure 18
Next, create a new simulation profile. Make sure the analysis type is set to Time Domain (Transient).
Under options, check the Parametric Sweep option. Under Sweep variable select Global parameter,
and type Rvar in the Parameter name field. Finally, under Sweep type select Value list and type the
resistor values separated by a comma.
Figure 19
Finally, click OK. We are now ready to simulate. Hit the play button and wait for the simulation
window to pop-up. You will get the following message:
Figure 20
In this window you can select individual cases for R. With all three cases selected, click OK.
Now place a Voltage Marker at the top node:
PARAMETERS:
34
Rvar = 1k
CMAX
L5
R7 1H C4
{Rvar } 10 m
IC = 0A IC = 5V
Figure 21
In the simulation window you should see all three plots in the same graph for the different values of
R.
5.0V
4.0V
3.0V
2.0V
1.0V
0V
-1.0V
0s 0.2s 0.4s 0.6s 0.8s 1.0s
V(L5:1)
Time
Figure 22
35