Вы находитесь на странице: 1из 39

List of Experiments to be done in Circuit Simulation Lab

1. Simulation of circuits using passive elements R, L, C


---2---
2. Characteristics of active devices (diode, BJT)
---1---
3. Amplifiers (BJT & OPAMP)
---1---
4. Oscillators/Generators(BJT & OPAMP)
---2---
5. General Applications of diodes, OPAMP, 555.
---2---
6. Analysis of signals and systems using Matlab
---2---

START UP INSTRUCTIONS

There are two ways we can simulate the circuits
A) Drawing the circuit and simulating using Capture CIS
B) Writing Netlist.

A Using Capture CIS
1. Open Capture CIS
startup AllprogramsOrCAD-9CaptureCIS
2. Create new project:
File new Project Create a new project: Give the following option
Analog or Mixed A/D
specify name of project as first letter of ur name in caps followed by last
4digits of ur registration number.
Location: D:\SCSLAB11\SecA1 (SecA2 and so on)
Finish
{If asked then use Create a blank project worksheet appears}

3. A blank worksheet appears if not click on + near the design +SCHEMATIC1
PAGE1
Right click on SCHEMATIC1 rename with G1L1E1.

(G1L1E1=> group 1, Lab1, experiment1)
This is a place where a circuit is to be drawn.

4. For every new circuit right click on the design name New SCHEMATICRename it
with G1L1E2(for group1, day1 expt2) till G5L8Ex(for group5, day8 expt-x)

B Writing Netlist
1. Open PSpice A/D
startup AllprogramsOrCAD-9 PSpice A/D
2. Create new text file:
File new text file
3. Save text file Expt-Name.cir in the folder named Folder-Name
at E:\SCSLAB11\SecA1 (SecA2 and so on)\ NetSIm
Folder-Name: The specify name of project as first letter of ur name in caps
followed by last 4digits of ur registration number.
Expt-Name: NG1L1E1 and so-on
(NG1L1E1=> UsingNetlist Group 1, Lab1, experiment1)
4. To simulate again open that file which was saved with cir extension and run.
5. For every new circuit follow steps 2-4. till experiment NG5L8Ex

Note(for staff and students): Follow the Naming-Convention properly.


Group 1 Lab 1 Experiment No 1

Objective : To verify the Kirchoffs voltage and current Laws (KVL &KCL) for a given DC circuit.
This will be accomplished by first analyzing the circuits by hand, and then using the software.

Q1. Verification of KVL and KCL.
Simulate the given circuit using DC analysis.
Compute the value of all branch currents and node voltages and verify KVL and KCL
laws.

Steps to draw the Schematic:
Get all components and place them in the worksheet as shown in figure 1.
Place part

1. Resistor: Select part R from Analog library:
Place 3 resistors on the schematic by left mouse click with space in between them.
Then right click rotate option and place 2 times as shown in figure in proper place.
To change the R value double click on the value on the screen ,type the value required in
value dialog box.

2. Place Voltage source / Current sources from the library Source (Vdc/Idc etc) and place them
on the schematic.
To set the value for the sources double click and type the value.

3. Place ground: go to Place ground. Use 0/source option.

4. Connect all the components as in the circuit diagram place wire

5. Save the schematic.



Figure 1. circuit for verification of KCL & KVL laws.
Analysis :

i) PSPICE create netlist
ii) To setup a PSPICE simulation click on PSPICE and then select New simulation
profile. Enter a filename for the simulation click on Create.
iii) Analysisedit the simulation set up
iv) Results if simulation is performed correctly the results are display on the
schematic.
v) Examine the output file for load current and load voltages. PSPICEView output file
and netlist file. PSPICE- view netlist created at the end of simulation.
vi) Once the simulation is finished a probe window pops up. From the TRACE Menu
select ADD TRACE and select the voltage and currents you like to display.

0
V1
15V
R5
10K
R4
36K
R3
4.7K
R2
20K
R1
2.2K

Figure 2. Verification of KCL laws

Figure 3. Verification of KCL laws
EXCERCISES:
Q1. Verify the KCL, KVL, Max power transfer theorem for the circuit shown

V_V1
0V 2V 4V 6V 8V 10V 12V 14V 16V
I(R1) I(R2) I(R3) I(R4) I(R5) I(V1)
-1.0mA
-0.5mA
0A
0.5mA
1.0mA
0
R1
10k R2
2k
R3
5k
L2
1mH
C1
1u
L1
5mH
V1
PHASE = 45
DC = 0
VOFF = 0
VAMPL = 10
FREQ = 1k
AC = 10

Group 1 Lab 1 Experiment No 2

Objective : To verify the Maximum Power Transfer Theorem for a given circuit


Figure 4.

SCHEMATICS:

To find Thevenins Circuit:

1. Draw the circuit without Rload.
2. Edit simulation for Bias point analysis -> Transfer function (.TF)
Give input voltage name as V2, and output name as voltage across R2 as V(2,1).
3. Run and check output file Note the value of output resistance which gives Thevenins
resistor.


To plot the graph.
1. Use Thevenins circuit

1. Place all circuit components
2. Place a New part, PARAM from Special Library
3. Edit Properties of PARAM : initialize the variable VAL to 1
4. Select Val, and click display -> name and Value
5. G to pspice, simulation settings, select dc sweep set the voltage,
6. Then click global parametric, set global variable name val and its values.
7. Run and verify
2. Use the given circuit with Rload to plot graph.
Results:
0
4
3 2
R3
5k
R2
10k
R1
10k
R4
1k
R5
10k
R6
5k
V2
10V
PARAMETERS:
v al = 1
Rload
{v al}

Figure 3.Simulated result (Power Vs R)
Net list code for figure 4 using thevenins circuit.
Vth 1 0 DC 10
.PARAM VAL=1
RTh 1 2 4.9k (approx)
Rload 2 0 {VAL}
.DC PARAM VAL 2k 8k 0.25k
.PROBE
.END
Analysis:
3. Go to pspice, simulation settings, select dc sweep set the voltage, click global parametric, set global
variable name val and its values.
4. Simulate it, go to add trace and type expressions in terms of voltages and currents.
5. Check your manually calculated values with simulated values, if both are matching; hence maximum
transfer theorem is satisfied.



val
0 1K 2K 3K 4K 5K 6K 7K 8K 9K 10K 11K 12K 13K 14K 15K
I(Rload) * V(2)
0.4mW
0.6mW
0.8mW
1.0mW
1.2mW
Group 1 Lab 2 Experiment No 3

Objective : To verify the Coupled Circuit

Figure1.Coupled circuits

Figure 2. Simulated Result
Procedure:
1. Draw the circuit as per circuit in figure 1.
2. Set the coupling 0.8 and edit K properties and set L1=L2
3. Save the file, go to Simulation settings, Select AC sweep, and select frequency range.
4. Simulate it; trace the result in the window like figure 2.
5. Compare the manually calculated result and simulated result.
NETLIST CODE
V1 1 0 AC 10 0
V2 5 0 AC 10 90
R1 1 2 10
L1 2 3 10M
L2 4 3 10
C1 3 0 1U
R2 4 5 10
K24 L1 L2 0.8
.AC LIN 10 10K 100
.PRINT AC IM (C1) IP (C1)
.END

EXCERCISES:
Q2. Design of a series Resonance circuit with cut off frequency 10 khz. (Hint AC analysis)
Also see the effect of variation in R, L, C (Hint: use PARAM along with AC analysis)

Group 2 Lab 3 Experiment No 1

Aim: To simulate and study the V-I characteristics of a diode .

Circuit Diagram:

Program:

Diode characteristic
VD 1 0 DC 0V ;
D1 1 2 D1N914 ;
VX 2 0 DC 0V ; measures the diode current Id
.MODEL D1N914 D (IS=3.93E-9 RS=1 BV=100V IBV=5E-6 CJO=1.7PF TT=2NS)
.DC VD -120V 10V 0.01V ; DC sweep
.PLOT DC I(VX); plots the diode current in the output file
.PROBE ; graphical waveform analyzer
.END ; end of ckt file


Graph:



0
D2
D1N4002
V1
5V
R1
1k
V_V1
-120V -110V -100V -90V -80V -70V -60V -50V -40V -30V -20V -10V 0V 10V
I(D2)
-30mA
-20mA
-10mA
0A
10mA
Note: Select Diode from Diode Library

Program:

Diode characteristic
VD 1 0 DC 0V ;
D1 1 2 D1N914 ;
VX 2 0 DC 0V ; measures the diode current Id
.MODEL D1N914 D (IS=3.93E-9 RS=1 BV=100V IBV=5E-6 CJO=1.7PF TT=2NS)
.DC VD -120V 10V 0.01V ; DC sweep
.PLOT DC I(VX); plots the diode current in the output file
.PROBE ; graphical waveform analyzer
.END ; end of ckt file

Graph:





Group 2 Lab 3 Experiment No 2


1. Aim: To simulate and study V-I characteristics of a NPN-BJT circuit in CE
configuration.

Circuit Diagram:


VD
-120V -110V -100V -90V -80V -70V -60V -50V -40V -30V -20V -10V 0V 10V
I(D1)
-20A
-15A
-10A
-5A
0A
5A
10A
0
1
2
V1
12V
Q1
Q2N2222A
I3
1mA
Program:

NPN BJT CHARACTERISTICS
IB 0 1 DC 1M
VCE 2 0 DC 12V
Q1 2 1 0 Q2N1566
.MODEL Q2N1566 NPN
+ IS 14.340000E-15 BF 173.4 VAF 74.03
+ CJE 22.010000E-12 CJC 9.393000E-12
+ TF 409.700000E-12 TR 48.390000E-09
.DC VCE 0 12 0.01 IB 0 1M 0.25M
.PROBE
.END

Graph:



Graph:



Exercise:

1. Plot the V-I characteristics for transistor in CB configuration
2. Measure h parameters from the transistor characteristics.
VCE
0V 1V 2V 3V 4V 5V 6V 7V 8V 9V 10V 11V 12V
IC(Q1) IB(Q1)
-40mA
0A
40mA
80mA
120mA
160mA
200mA
Group 3 Lab 4 Experiment No 1

Objective: To design and test an RC coupled amplifier with and without feedback and to plot its
frequency response
Given: stability factor s=6, Vceq=5v,Iceq=2mA











RC Coupled Amplifier

Aim: To design and test RC Coupled Amplifier with and without feedback and to plot its
frequency response for following specification.
a) Stability factor S = 6
b) V
CEQ
= 5V, I
CQ
= 2mA

Frequency
1.0Hz 10Hz 100Hz 1.0KHz 10KHz 100KHz 1.0MHz 10MHz 100MHz 1.0GHz 10GHz
20*LOG( V(C3:2)/ V(V1:+))
-100
-50
0
50
100
G
A
I
N
0
R4
3.3k
R3
560
R2
3.3k
R1
22k
C2
100u
C1
10u
Q1
Q2N2222
C3
10u
R5
1k
V1
V2
15v
Design:

1. Selection of V
CC
:
Given V
CEQ
= 5V and I
CQ
= 2mA
For thermal stabilization
V
CEQ
V
CC
/2 or V
CC
2V
CEQ

Therefore V
CC
= 12V.

2. Selection of R
E
:
Let the voltage drop across R
E
= 10 % of V
CC

V
RE
= 1.2V, now I
C
I
E
=2mA
Therefore RE = V
RE
/I
E
= 1.2/2m = 600
Select R
E
= 620 standard value.

3. Selection of R
C
:
R
C
= V
RC
/I
C
, here V
RC
= V
CC
V
CEQ
V
RE

12 5 1.2 = 5.8V
R
C
= 2.9k
Select R
C
= 3k standard value.

4. Selection of R
1
and R
2

Transistor is BC107, from data book h
FE
= 200 =

( )( )
] / [ 1
] / [ 1 1
E B
E B
R R
R R
S
+ +
+ +
=

where R
B
= R
1
R
2

Given S = 6, = 200, we get R
B
3k
Now V = I
B
R
B
+ V
BE
(1+ ) I
B
R
E

Where I
B
= I
C
/ = 10A, V
BE
= 0.7V
We get V = 1.936V

2
2 1
R
R R
V
V
CC
+
=
and R
B
= R
1
R
2

1
R
R V
V
B CC
=
R
1
= 18.59k 22k (std)
R
2
= 3.57k = 3.3k (std)
5. Selection of Coupling Capacitor:
Let reactance of C
C
is one tenth of input resistance R
i


R
i
= R
1
R
2
= h
FE
. r
e


r
e
= 25mv/ I
E
= 12.5, R
i
= 133, X
CC
= 1/ 2f
L
C
C


where f
L
= lower cut-off frequency = 200Hz
C
C
= 6F 10F

6. Selection of emitter bypass capacitor C
E
:

Let f
L
= 200Hz, f
L
=
E E
C R
R
R
2
1
'
+


Where R' h
FE
R
E
= 124k

R h
ie
= 2.2k , C
E
= 73.63F

C
E
= 100F.

a) With feedback C
E
not connected
b) Without feedback C
E
connected.


NETLIST
VIN 1 0 AC 10M SIN(0 10M 1K)
VCC 0 7 DC 15
R1 7 3 22K
R2 3 0 3.3K
RC 7 4 3.3K
RE 5 0 560
RL 6 0 1K
C1 2 3 10U
C2 4 6 10U
CE 5 0 100U
* NC NB NE Qname
XQ1 4 3 5 JUNK
*SUBCKT DESCRIPTION OF JUNK
.SUBCKT JUNK 6 7 5
RB 1 2 100
RE 3 5 1
RC 4 6 10
RBE 2 3 1K
R0 4 3 100K
*DUMMY VOLTAGE SOURCE
V1 7 1 DC 0
*CURRENT CONTROLLED CURRENT SOURCE
F1 4 3 V1 20
.ENDS
*END OF SUBCKT JUNK
.TRAN 50U 2M
.AC DEC 10 1 10G
.OP
.PROBE
.END


Group 3 Lab 4 Experiment No 2

Objective: To design a inverting amplifier using Op-amp uA741 for a gain of 50. Simulate and note the
roll off rate. Plot the frequency response.
To get OPAMP, select Place part->Add Library->Opamp.lib->UA741
Design: Gain=Rf/R1., UGB=1MHZ ; Cuttoff Freq=UGB/Gain



Exercise: Design a Non-inverting amplifier for a gain of 100 using uA741 and find the roll off
rate per octave.
0
V3
PHASE = 0
FREQ = 1k
VAMPL = 5
V2
10V
V1
10V
U1
uA741
3
2
7
4
6
1
5
+
-
V
+
V
-
OUT
OS1
OS2
Rf 50k
R1
1k
Frequency
10Hz 30Hz 100Hz 300Hz 1.0KHz 3.0KHz 10KHz 30KHz 100KHz 300KHz 1.0MHz
20* LOG10(V(U1:OUT)/V(V3:+))
-10
0
10
20
30
40
G
a
i
n

i
n

d
B
(19.415K,31.031)
(197.975K,13.862)

Group 4 Lab 5 Experiment No 1

Objective: To generate the sinusoidal signal of desired frequency

Design:
=

V

Where:
is the Output Frequency in Hertz
R is the Resistance in Ohms
C is the Capacitance in Farads
N is the number of RC stages. (in our example N = 3)
The resistor-capacitor combination in the RC Oscillator circuit also acts as an attenuator
producing an attenuation of 1/29th (Vo/Vi) per stage, the gain of the amplifier must be sufficient
to overcome the losses and must be greater than 29.



Use .LIB in case Netlist

0
0
R10
4.7K
R9
4.7K
R8
1k
R7
16K
R6
4.7K
R5
82K
Q1
Q2N2222
C8
0.05U
C7
0.05U
C6
0.05U
R11
1.2K
V2
10V
C9
15U
Group 4 Lab 5 Experiment No 2


Objective: To generate the sinusoidal signal of desired frequency

Design:
The frequency of oscillations for a Hartley Oscillator is given as:
=

nVI

The circuit consists of two inductive coils in series, so the total inductance is given as:
I = I
1
+I
2





0
0
R6
1M
R5
4.7K
R4
3M
J1
BF256C
L2
200U
L1
200U
C3
560U
C2
10U
C1
10U
R7
3.3K
C4
10U
V7
15V
Group 4 Lab 6 Experiment No 3


Objective: To design a square wave generator using Op-amp for a desired frequency and duty cycle.


Design:
1
J
= = 2RC
1+
1-


Where =
R
3
R
3
+R
1





Group 4 Lab 6 Experiment No 4


Objective: To design a triangular wave generator with specified peak value and frequency.

Amplitude of triangular wave is given by

And output frequency is
f
out
=
1
(
R
5

)
4R
4
C
1
R
6


0
R1
V1
10V
V2
10V
R3
U1
uA741
3
2
7
4
6
1
5
+
-
V
+
V
-
OUT
OS1
OS2
Rf
C1
R
5

R
6



Exercise:
1) Design the square wave for variable duty cycle
2) Design sawtooth wave generator from triangular wave generator

Group 5 Lab 7 Experiment No 1

Objective: Design a single phase-Full wave bridge rectifier with a supply of 120V,60Hz. Without any
input Transformer.Take R
L
=500ohm and Ripple factor RF=5%.
Design : Given Ripple factor r=5%=0.05
r=1/43*f*C*RL
C=1/43*60*500*0.05=96.22UF.
Take Diode from palce part->Add library->Diode.lib-> DIN4148





R5
33K
0
C1
0.01U
V4
12Vdc
0V
19.48uV
817.2uV
-12.00V
V5
12Vdc
U2
uA741
3
2
7
4
6
1
5
+
-
V
+
V
-
OUT
OS1
OS2
-19.25uV
12.00V
R4
10K
U3
uA741
3
2
7
4
6
1
5
+
-
V
+
V
-
OUT
OS1
OS2
R6
10K
0
V1
60
R1
500
D5
D1N4148
D6
D1N4148
D7
D1N4148
D8
D1N4148
C4
96.22u


NETLIST
V1 1 0 SIN(0 169.7V 60Hz)
C 2 3 96.22UF
R1 2 3 500
D1 1 2 DIN4148
D2 3 0 DIN4148
D3 0 2 DIN4148
D4 3 1 DIN4148
.MODEL DIN4148 D
.TRAN 20U 60MS
.PROBE
.END

Group 5 Lab 7 Experiment No 2

Objective: Design a opamp summer to give output Vo=(V1+V2),where V1 and V2 are input voltages.
Design: We have Vo= RF(V1/R1+V2/R2), Take R1=R2=RF=1K. then Vo=V1+V2.

Time
0s 5ms 10ms 15ms 20ms 25ms 30ms 35ms 40ms 45ms 50ms 55ms 60ms
V(R1:2)- V(R1:1)
0V
50V
100V
V
O
L
T
A
G
E



NETLIST
*USING .LIB METHOD
VCC 60 DC 12V
VEE 70 DC -12V
V1 1 0 SIN(0 1 5)
V2 2 0 SIN(0 3 5)
R1 3 1 1K
R2 32 1K
R3 40 1K
RF 5 4 1K
*Vi+ Vi- VCC VEE O/p <opamp NAME>
XA1 4 3 6 7 5 UA741
.LIB
.TRAN 0.001 2S
.PROBE
.END



0
0
R4
1k
R3
1k
R2
1k
R1
1k
U1
uA741
3
2
7
4
6
1
5
+
-
V
+
V
-
OUT
OS1
OS2
V4
12
V3
12
V2
2V
V1
4V
Time
0s 0.2s 0.4s 0.6s 0.8s 1.0s 1.2s 1.4s 1.6s 1.8s 2.0s
V(2) V(5) V(1)
-4.0V
-2.0V
0V
2.0V
4.0V
V
O
L
T
A
G
E
V2
V1
OUTPUT
Group 5 Lab 8 Experiment No 3

Objective: Design a first order low pass filter to give a cut off frequency f=1KHz with
passband gain of 4. Choose C=0.01uF.
Design: R=1/2n =1/2*1K*0.01u =15916.
Choose value of R1 and Rf to meet the passband gain K=4.
K=1+R3/R2 R3/R2= 4-1=3. Let R2=10K then R3=30K
.







NETLIST
V 1 0 AC 1v
R1 1 2 15916
C 2 0 0.01uF
RIN 3 2 2MEG
ROUT 5 4 75
EA 5 0 2 3 2E+5
R2 3 0 10K
R3 3 4 30K
.AC DEC 100 10HZ 10KHZ
.PROBE
.END


Group 5 Lab 8 Experiment No 4


Output :

NETLIST
* source SCS
V1 1 0 DC 0 AC 10
<Doc> <Rev Code>
<Title>
A
1 1 Thursday , July 21, 2011
Title
Size Document Number Rev
Date: Sheet of
V3
0Vdc
D1
D1N4001
R2
1k
R3
1k
0
V2
0Vdc
D2
D1N4001
U1
uA741
3
2
7
4
6
1
5
+
-
V
+
V
-
OUT
OS1
OS2
V1
FREQ = 10000
VAMPL = 10
VOFF = 0
R1
1k
Time
0s 1ms 2ms 3ms 4ms 5ms 6ms 7ms 8ms 9ms 10ms
V(R1:1) V(V1:+)
-20V
-10V
0V
10V
20V
+SIN 0 10 1000 0 0 0
XA1 2 1 6 7 3 uA741
D1 4 2 D1N4001
D2 2 5 D1N4001
R1 3 4 1k
R2 3 5 1k
R3 2 0 1k
V2 6 0 dc 12
V3 0 7 DC 12
.lib "C:\Program Files\Orcad\Capture\Library\PSpice\opamp.lib"
.lib "C:\Program Files\Orcad\Capture\Library\PSpice\diode.lib"
.tran 1m 10m
.probe
.end

Group 5 Lab 8 Experiment No 5



Place 555alt from ANL_MISC Library
For Trigger (square wave) use VPULSE

0
0
R2
10k
V2
5v
R6
10k
C2 0.01u
V6
C3
1u
U5
555alt
1
2
3
4
5
6
7
8
GND
TRIGGER
OUTPUT
RESET
CONTROL
THRESHOLD
DISCHARGE
VCC

Exercise:
1. Design an integrator using opamp for time constant 0.1msec.
2. Design Zener voltage regulator for the parameters of the zener diode Vz=4.7v.The current-
limiting resistance Rs=1Kohm.The input voltage to the limiter is given by Vs=15sin(2000t)








3. Study the diode clipper circuit and simulate.


Time
0s 1ms 2ms 3ms 4ms 5ms 6ms 7ms 8ms 9ms 10ms 11ms 12ms 13ms 14ms 15ms
V(U5:OUTPUT)
-5.0V
0V
5.0V
V(U5:TRIGGER)
0V
2.5V
5.0V
SEL>>
1 2
0
R1
1k
V2
D1
D1N3940
Time
0s 10us 20us 30us 40us 50us 60us 70us 80us 90us 100us
V(1) V(2)
-5.0V
0V
5.0V
0
R2
1k
D2
D1N750
D1
D1N750
V1




4. simulate and study the diode clamper circuit.





5. Design a clipper circuit to clip off the portion of an input voltage that falls above 9v or
below -5 v and gives the following transfer characteristics.



6. Design a circuit to verify the half-wave rectifying properties of the diode which gives the
following transfer characteristics.

V_V2
-16V -14V -12V -10V -8V -6V -4V -2V 0V 2V 4V 6V 8V 10V 12V 14V 16V
V1(D1)
-15V
-10V
-5V
0V
5V
0
1 2
R1
560k
V6 D5
D1N3491
C1
0.01uf
Time
0s 10us 20us 30us 40us 50us 60us 70us 80us 90us 100us
V(1) V(2)
-10V
-5V
0V
5V
V_V6
-20V -15V -10V -5V 0V 5V 10V 15V 20V
V(0) V(V0)
-10V
-5V
0V
5V
10V





Note: Practice all possible circuits that are discussed in Analog Electronics and Basic
Electronics Syllabus.





PART II - MATLAB


INTRODUCTION TO MATLAB

How to start matlab?
Click on start->programs-> MATLAB 7.0.4
Command window will get opened
V_V6
-20V -15V -10V -5V 0V 5V 10V 15V 20V
V(Vout)
-4V
0V
4V
8V
12V
16V
20V

Now you can enter the commands and functions directly in command window.
Try some examples in the command window:
1. A=ones(R,C)
R=number or rows C=number of columns.
A=ones(3,3), A=zeros(3,3)

Study different functions like:-
2. Plot-> used to plot continuous time signal
Example
plot(x,y)
Where x and y have to be defined .
3. Subplot
h = subplot(m,n,p), or subplot(mnp) breaks the Figure window into an m-by-n matrix of
small axes, selects the pth axes object for for the current plot, and returns the axis handle.
The axes are counted along the top row of the Figure window, then the second row, etc.
For example:
subplot(2,1,1), plot(A)
subplot(2,1,2), plot(B)
plots A on the top half of the window and B on the bottom half.

4. Stem-> used for plotting discrete time signals.
Study the fallowing functions using the matlab help menu.

Figure, Title ,label, axis, linespace , grid on

Also Study the arithmetic logical and relational operations using matlab help menu.

M-file editor
We should type the program in the m-file editor in a sequence and then save and then run.
From file menu select NEW->M-File option
Edit window will appear with untitled
Enter the program statements. Save the program with name.
Run the program either from command window or from editor window.









Group 6 Lab 9 Experiment No 1


Objective: To Generate and plot the Sinusoidal signal of frequency 20Hz.
t=0:.001:0.5;
x=5*sin(2*pi*t*20);
plot(t,x);
title('SINE WAVE');
xlabel('time');
ylabel('amplitude');




Group 6 Lab 9 Experiment No 2

Objective: To study and find the convolution of two signals.

close all;
clear all;
t1=-10:.01:0;
t1=t1';
g1=-2*exp(2*t1);
t2=0:.01:10;
t2=t2';
g2=2*exp(-t2);
t=[t1;t2];
g=[g1;g2];
f=[zeros(size(g1));ones(size(g2))];
subplot(3,1,1);
plot(t,f);
title('f(t)');
subplot(3,1,2);
plot(t,g);
title('g(t)');
c=0.01*conv(f,g);
t=-20:.01:5;
subplot(3,1,3);
plot(t,c(1:length(t)));
title('c(t)');
grid on;



Exercise:
1. Generate the sinusoidal signal of frequency 50,60, 70 Hz .
2. Generate square wave and triangular wave of different frequency.
3. Generate and plot signal |n] = (

, )
n
{(n) -(n -)].
If the impulse response of the system is |n] = {(n) -(n -)]. Find & plot the
output signal.

Group 6 Lab 10 Experiment No 3

Ojective: To find the impulse response of a system defined by difference equation
y(n)-0.6y(n-1)-0.16y(n-2)=5x(n)
Use of filter function
close all;
clear all;
n=20;
b=[5 0 0];
a=[1 -0.6 -0.16];
f=[1,zeros(1,n-1)];
y=filter(b,a,f);
k=0:1:n-1;
stem(k,y);
xlabel('n');
ylabel('h(k)');






Group 6 Lab 10 Experiment No 4

Objective: To find the impulse response of a system defined by
difference equation y(n)-0.6y(n-1)-0.16y(n-2)=5x(n)
or
Z-Transform of system H(z) = (1+2z^-1) / (1-0.2z^-1)(1+0.6z^-1)

Use of impz function
This can be used to find the impulse response of the digital filter. (This is actually calculates the
inverse z-transform by power series method).
Given:
H(z) = (1+2z^-1) / (1-0.2z^-1)(1+0.6z^-1)

close all;
clear all;
L=11;
n=[1 2];
d=[1 0.4 -0.12];
[y t]=impz(n,d,L);
stem(y); grid on;






Group 6 Lab 10 Experiment No 5


objective: To study the Fast Fourier Transform and its properties.
clc;
clear all;
close all;
x=input('enter the sequence');
n=input('enter the length of fft');
%compute fft
disp('fourier transformed singal');
X=fft(x,n);
subplot(1,2,1);
stem(x);
title('input signal');
xlabel('n');
ylabel('x(n)');
grid on;
subplot(1,2,2);
stem(X);
title('fft of input x(n)is');
xlabel('real axis');
ylabel('imaginary axies');


enter the sequence [1 2 3 4]
enter the length of fft 8
fourier transformed singal

Group 6 Lab 10 Experiment No 6

Objective: To study the Z- Transform and its properties.
Express the following Z-transform in factored form,plot its poles and zeros,and then determine
its ROCs.
H(z) = (2z^4+16z^3+44z^2+56z+32) / (3z^4+3x^3-15z^2+18z-12)
close all;
clear all;
n=[2 16 44 56 32];
d=[3 3 -15 18 -12];
[z p k]=tf2zp(n,d);
m=abs(p);
disp('Zeros are at');
disp(z);
disp('Poles are at');
disp(p);
disp('Gain Constant is');disp(k);
disp('Radius of poles');disp(m);
sos=zp2sos(z,p,k);
disp('Second order system');
disp(real(sos));
zplane(n,d);




Exercise:
1. Use commands tf2zp, zp2tf, ss2tf, tf2ss
2. Use commands: residue: [r,p,k] = residue(num,den)
3. Use commands: step: step(num,den)
4. To plot the impulse response, type: impulse(num,den)
5. Use commands: semilogx
6. Use commands: freqz: The DTFT of a system can be calculated from the transfer
function using freqz. [H,Omega] = freqz(num,den,n,'whole');

Вам также может понравиться