You are on page 1of 31

LABORATORY MANUAL

ECE 303 Unified Electronics Lab-III

ECE 303

Page 1

Sr No. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12.

Title of the Experiment


To develop program for linear convolution and correlation using MATLAB. To develop a program for computing circular convolution Using MATLAB. To develop a program for computing DFT and IDFT using MATLAB. To develop a program for computing inverse Z-transform using MATLAB. To develop a program for designing FIR Filter in MATLAB. To develop a program for designing IIR Filters in MATLAB. To generate a FM Signal and measure Depth of modulation. To obtain Amplitude modulated envelope and determine depth of modulation To study envelope detector for demodulation of AM signal and observe diagonal peak clipping effect. Design Hartley oscillator and determine lowest and highest frequency it can generate. Design and observe waveforms of colpitts oscillator, compare its characteristics with Hartley oscillator. Design RC phase shift oscillator and determine lowest and highest frequency it can generate.

Page No. 3 6 8 11 13 16 18 21 24 26 28 30

ECE 303

Page 2

Experiment:1 1. Experiment: To verify Linear Convolution. Equipments Required: Software -- MATLAB 7.5 2. Learning Objectives: To make the students familiar with concept of discrete convolution and correlation with the use of MATLAB. 3. Outline of the Procedure: 1. 2. 3. 4. 5. 6. Enter the input Sequence, x having length=4 Enter the Impulse Sequence, h having length=4 Performing the Convolution, store the value in y Plotting the Input Sequence. Plotting the Impulse Sequence. Plotting the Output Sequence.

PROGRAM CODE : (for linear convolution)


%linear convolution program: clc; clear all; close all; disp('linear convolution program'); x=input('enter i/p x(n):'); m=length(x); disp(m); h=input('enter i/p h(n):'); n=length(h); disp(n); x=[x,zeros(1,n)];
subplot(2,2,1), stem(x); title('i/p sequence x(n)is:'); xlabel('---->n'); ylabel('---->x(n)');grid; h=[h,zeros(1,m)]; subplot(2,2,2), stem(h); title('i/p sequence h(n)is:'); xlabel('---->n'); ylabel('---->h(n)');grid;

disp('convolution of x(n) & h(n) is y(n):'); y=zeros(1,m+n-1); for i=1:m+n-1 y(i)=0; for j=1:m+n-1 if(j<i+1) y(i)=y(i)+x(j)*h(i-j+1); end end end

ECE 303

Page 3

subplot(2,2,[3,4]),stem(y); title('convolution of x(n) & h(n) is :'); xlabel('---->n'); ylabel('--->y(n)');grid; disp(y);

4. Required Results:

ALGORITHM: (for discrete correlation) 1 Enter the input Sequence, x having length=4 2 Enter the Impulse Sequence, y having length=4 3 Performing the Correlation, store the value in y 4 Plotting the Output Sequence, store in z. PROGRAM CODE: %program for discrete Correlation x=[1 2 3 4]; y=[2 3 4 5]; z=xcorr(x,y); stem(z); subplot(2,2,1),stem(x)

ECE 303

Page 4

title(input sequence 1) subplot(2,2,2),stem(y) title(input sequence 2) subplot(2,2,3),stem(z) title(output sequence)

RESULT:
input sequence 1 4 3 2 2 1 6 input sequence 2

01

output sequence 40 30 20 10

5. Learning Outcomes: To be written by students in 50-70 words.

ECE 303

Page 5

Experiment: 2 1. Experiment: To verify Circular Convolution.


Equipments Required: Software - MATLAB 7.5
2. Learning Objectives: To make the students familiar with concept of circular convolution

with the help of MATLAB. 3. PROGRAM CODE:


%circular convolution program: clc; clear all; close all; disp('circular convolution program'); x=input('enter i/p sequence x(n):'); a=length(x); disp(a); h=input('enter i/p sequence h(n):'); b=length(h); disp(b); subplot(2,2,1), stem(x); title('i/p sequence x(n)is:'); xlabel('---->n'); ylabel('---->x(n)');grid; subplot(2,2,2), stem(h); title('i/p sequence h(n)is:'); xlabel('---->n'); ylabel('--->h(n)');grid minor; disp('circular convolution of x(n) &
if(a>b) n=a; else n=b;

h(n)

is

y(n):');

end if(ab~=0) if(a>b) h=[h,zeros(1,ab)]; else x=[x,zeros(1,ba)]; end end disp(x); disp(h);
y=zeros(1,n); for i=1:n y(i)=0; k=i; for j=1:n y(i)=y(i)+(x(j)*h(k)); if k==1

k=n+1;

ECE 303

Page 6

end k=k-1;

end end
subplot(2,2,[3,4]),stem(y); title('circular convolution of x(n) & h(n) is:'); xlabel('---->n'); ylabel('---->y(n)');grid;

disp(y);

4. Required Results:

5. Learning Outcomes: To be written by students in 50-70 words.

ECE 303

Page 7

Experiment: 3 1. Experiment: To develop a program for Computing DFT and IDFT in MATLAB Equipments Required: MATLAB 7.5 2. Learning Objectives: To make the students familiar with concept of DFT and IDFT with the use of MATLAB. 3. Outline of the Procedure : ALGORITHM (For DFT): 1 Enter the input Sequence, x having length=4 2 Set the range of k according to the length of x. 3 Computing DFT, store the value in X(k). 4 Plotting the DFT of given Sequence, store in X(k). PROGRAM CODE:
% Program to perform Discrete Fourier Transform: clc; clear all; close all hidden; x=input('The given i/p sequence is x(n): ');
subplot(2,2,[1,2]), stem(x); title('i/p sequencce x(n)is:'); xlabel('---->n'); ylabel('---->x(n)');grid; N=length(x); for k=1:N X(k)=0; for n=1:N

X(k)=X(k)+x(n).*exp(-j.*2.*pi.*(n-1).*(k-1)./N); end end disp('The DFT of the i/p sequence x(n) is X(n):') p=0:(N-1); subplot(2,2,[3,4]), stem(p,abs(X)); title('The DFT of the i/p sequence x(n) is X(n):'); xlabel('---->n'); ylabel('--->X(n)');grid; disp(X);

Input

Sequence:-

ECE 303

Page 8

ALGORITHM (For IDFT): 1 Enter the input Sequence, x having length=4 2 Set the range of k according to the length of x. 3 Computing IDFT, store the value in X(k). 4 Plotting the IDFT of given Sequence, store in X(k). PROGRAM CODE:
% Program to perform Inverse Discrete Fourier Transform: clc; clear all; close all hidden; X=input('The given i/p sequence is X(n): subplot(2,2,[1,2]), stem(X);

');

title('i/p sequencce X(n)is:'); xlabel('---->n'); ylabel('---->X(n)');grid; N=length(X); for n=1:N

x(n)=0; for k=1:N x(n)=x(n)+X(k).*exp(j.*2.*pi.*(n-1).*(k-1)./N); x(n)=x(n)./N; end end disp('The IDFT of the i/p sequence X(n) is x(n):') p=0:(N-1); subplot(2,2,[3,4]), stem(p,abs(x)); title('The IDFT of the i/p sequence X(n) is x(n):'); xlabel('---->n'); ylabel('---->x(n)');grid; disp(x);

4. Required Results: For DFT

ECE 303

Page 9

For IDFT

5. Learning Outcomes: To be written by students in 50-70 words.

ECE 303

Page 10

Experiment: 4 1. Experiment: To develop a program for Computing Inverse Z-Transform Equipments Required: MATLAB 7.5 2. Learning Objectives: To make the students familiar with concept of inverse Ztransform with the use of MATLAB. 3. Outline of the Procedure: ALGORITHM 1. Write the poles and zeros of the input sequence. 2. Returned vector R contains the residues, Column vector contains P contains the pole locations. And row vector contains the direct terms. Input Sequence:

PROGRAM CODE:
%program to perform Inverse ZTransform b=[1,0.4*sqrt(2)]; a=[1,0.8*sqrt(2),0.64]; [R,P,C]=residuez(b,a); R P C Zplane(b,a);

ECE 303

Page 11

4. Required Results:

5. Learning Outcomes: To be written by students in 50-70 words.

ECE 303

Page 12

Experiment: 5 1. Experiment: To verify FIR filters. Equipments Required: MATLAB Software 2. Learning Objectives: To make the students familiar with designing concepts of FIR filter with the use of MATLAB. 3. PROGRAM CODE: %fir filt design window techniques clc; clear all; close all; rp=input('enter passband ripple'); rs=input('enter the stopband ripple'); fp=input('enter passband freq'); fs=input('enter stopband freq'); f=input('enter sampling freq '); wp=2*fp/f; ws=2*fs/f; num=20*log10(sqrt(rp*rs))-13; dem=14.6*(fs-fp)/f; n=ceil(num/dem); n1=n+1; if(rem(n,2)~=0) n1=n; n=n-1; end c=input('enter your choice of window function 1. rectangular 2. triangular 3.kaiser: \n '); if(c==1) y=rectwin(n1); disp('Rectangular window filter response'); end if (c==2) y=triang(n1); disp('Triangular window filter response'); end if(c==3) y=kaiser(n1); disp('kaiser window filter response'); end %LPF b=fir1(n,wp,y); [h,o]=freqz(b,1,256);
ECE 303 Page 13

m=20*log10(abs(h)); subplot(2,2,1);plot(o/pi,m); title('LPF'); ylabel('Gain in dB-->'); xlabel('(a) Normalized frequency-->'); %HPF b=fir1(n,wp,'high',y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,2);plot(o/pi,m); title('HPF'); ylabel('Gain in dB-->'); xlabel('(b) Normalized frequency->'); %BPF wn=[wp ws]; b=fir1(n,wn,y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,3);plot(o/pi,m); title('BPF'); ylabel('Gain in dB-->'); xlabel('(c) Normalized frequency-->'); %BSF b=fir1(n,wn,'stop',y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,4);plot(o/pi,m); title('BSF'); ylabel('Gain in dB-->'); xlabel('(d) Normalized frequency-->') 4. Required Results:

ECE 303

Page 14

5. Learning Outcomes: To be written by students in 50-70 words.

ECE 303

Page 15

Experiment: 6 1. Experiment: To design and implement IIR (LPF/HPF) filters.


Equipments required: Software - MATLAB

2. Learning Objectives: To make the students familiar with designing concepts of FIR filter with the use of MATLAB. PROGRAM CODE:

% IIR filters LPF & HPF clc;clear all;close all; disp('enter the IIR filter design specifications'); rp=input('enter the passband ripple'); rs=input('enter the stopband ripple'); wp=input('enter the passband freq'); ws=input('enter the stopband freq'); fs=input('enter the sampling freq'); w1=2*wp/fs;w2=2*ws/fs; [n,wn]=buttord(w1,w2,rp,rs,'s'); c=input('enter choice of filter 1. LPF 2. HPF \n '); if(c==1) disp('Frequency response of IIR LPF is:'); [b,a]=butter(n,wn,'low','s'); end if(c==2) disp('Frequency response of IIR HPF is:'); [b,a]=butter(n,wn,'high','s'); end w=0:.01:pi; [h,om]=freqs(b,a,w); m=20*log10(abs(h)); an=angle(h); figure,subplot(2,1,1);plot(om/pi,m); title('magnitude response of IIR filter is:'); xlabel('(a) Normalized freq. -->'); ylabel('Gain in dB-->'); subplot(2,1,2);plot(om/pi,an); title('phase response of IIR filter is:'); xlabel('(b) Normalized freq. ->'); ylabel('Phase in radians-->');

ECE 303

Page 16

3. Required Results:

4. Learning Outcomes: To be written by students in 50-70 words.

ECE 303

Page 17

1.

Experiment -7 Experiment : To generate a FM Signal and measure Depth of modulation Equipments required: IC LM 2206,10k, two 100k, three 4.7k, 220ohm resistor values, 22F,1F, 10F, 0.01F capacitor values, CRO(20 Mhz), Function generator (1Mhz), connecting wires and probes.

2. 3.

Learning Objectives: To implement the concept of Frequency modulation (already taught). Circuit Diagram:

4. Outline of the Procedure: a) Connect the circuit as per the given circuit diagram. b) Apply the modulating signal of 100HZ with 3Vp-p. c) Trace the modulated wave on the C.R.O & plot the same on graph. d) Find the modulation index by measuring minimum and maximum frequency deviations from the carrier frequency using the CRO. e) M = S/f = maximum Frequency deviation /modulating signal frequency
f) Repeat the steps 3& 4 by changing the amplitude and /or frequency of the modulating

Signal.

ECE 303

Page 18

5. Required Results:

ECE 303

Page 19

6. Observation Table:

Formula used: m f = / f m where = k Vm fc K is the proportionality constant 7. Learning Outcomes: To be written by students in 50-70 words.

ECE 303

Page 20

Experiment -8 1. Experiment : To design and implement on a breadboard a circuit to perform Amplitude modulation. Equipments Required: Two IC BC 107BP, 10k, 20kohm resistor, three 0.01F capacitor, CRO(20 Mhz), Function generator(1Mhz), connecting wires and probes. 2. Learning Objectives: To implement the concept of Frequency modulation (already taught). 3. Circuit diagram:

4. a) b) c) d)

Outline of the Procedure: Connect the circuit as per the given circuit diagram. Apply fixed frequency carrier signal to carrier input terminals. Apply modulating signal from function generator of 0.8VP-P of 1KHz. Note down and trace the modulated signal envelop on the CRO screen. 5. Find the modulation index by measuring Vmax and Vmin from the modulated (detected/ traced) envelope. e) M=(Vmax Vmin)/(Vmax+Vmin) f) Repeat the steps 3,4 & 5 by changing the frequency or/& amplitude of the modulating signal so as to observe over modulation, under modulating and perfect modulation. g) For demodulation, apply the modulated signal (A.M) as an input to the demodulator and verify the demodulated output with respect to the applied modulating signals and their respective outputs.

ECE 303

Page 21

5. Required Results:

ECE 303

Page 22

6. Observation Table: m= (Vmax + V min) / (V max V min )

Error Analysis: Calculate Modulation index using mathematical formula mc = Vm/Vc. %AGE ERROR = ((m mc)/ mc)x100% 7. Learning Outcomes: To be written by students in 50-70 words.

ECE 303

Page 23

Experiment -9 1. Experiment : To study envelop detector for demodulation of AM signal and observe diagonal peak clipping effect. Equipments Required: Diode (0A79), 100 K-ohm resistance, capacitor 2uF, CRO (20 Mhz),Function generator(1Mhz),connecting wires and probes. 2. Learning Objectives: Practically implement the concept of Amplitude demodulation (already learnt). 3. Circuit Diagram:

4. Outline of the Procedure: a) Connect the circuit diagram as shown above . b) Feed the AM wave to the demodulator circuit and observe the output c) Note down frequency and amplitude of the demodulated output waveform. d) Draw the demodulated wave form .,m=1 5. Required Results:

ECE 303

Page 24

6. Observation Table:

7. Learning Outcomes: to be written by students in 50-70 words.

ECE 303

Page 25

Experiment-10 1. Experiment: Design Hartley oscillator and determine lowest and highest frequency it can generate. Equipments Required: BF594, 56k,5.6k, 1k, 100ohm-resistors,330pf variable capacitor(ganged), inductor coil,22uF, 0.1uFcapacitor, CRO(20 Mhz), connecting wires and probes. Learning Objectives: to implement the concept of oscillator designing in laboratory.

2.

3. Circuit Diagram:

4. Outline of the Procedure: a) b) c) d) e) Connect the circuit as shown in figure. Connect CRO at the output terminal. Observe the output of the oscillator on a CRO, Note down the repetition period (T) of observed signal. Compute f o== 1/T Calculate the theoretical frequency of the circuit using the formulae.

ECE 303

Page 26

5. Observation Table:

6. Learning Outcomes: To be written by students in 50-70 words.

ECE 303

Page 27

Expeiment-11 1. Experiment: Design and observe waveforms of colpitts oscillator, compare its characteristics with Hartley oscillator. Equipments Required: BF494, capacitor-0.1uF, 330pF, inductance-variable, resistor56kohm, supply voltage, CRO. 2. Learning Objectives: to implement the concept of oscillator designing in laboratory.

3. Circuit Diagram:

4. Outline of the Procedure: a) b) c) d) e) Connect the circuit as shown in figure. Connect CRO at the output terminal. Observe the output of the oscillator on a CRO, Note down the repetition period (T) of observed signal. Compute f o== 1/T V. Calculate the theoretical frequency of the circuit using the formulae.

ECE 303

Page 28

5. Observation Table:

6. Learning Outcomes: To be written by students in 50-70 words.

ECE 303

Page 29

Expeiment-12 1. Experiment: Design RC phase shift oscillator and determine lowest and highest frequency it can generate Equipments Required:

2. Learning Objectives: to implement the concept of oscillator designing in laboratory. 3. Circuit Diagram:

ECE 303

Page 30

4. a) b) c) d) e) f)

Outline of the Procedure: Connect the circuit as shown. S wi t c h o n t h e p o we r s u p p l y . Connect the CRO at the output of the circuit. Adjust the RE to get undistorted waveform. Measure the Amplitude and Frequency. Compare the theoretical and practical values.

g) Plot the graph amplitude versus frequency

5. Observation Table:

f = 1 / 2 RC 6+4K=1 / 2 (10K) (0.01F) 6+4(0.01)= 647.59Hz

6. Learning Outcomes: To be written by students in 50-70 words.

ECE 303

Page 31

You might also like