lab mnual 303

31
ECE 303 Page 1 LABORATORY MANUAL ECE 303 Unified Electronics Lab-III

Upload: mayank-maurya

Post on 26-Nov-2015

49 views

Category:

Documents


4 download

DESCRIPTION

a

TRANSCRIPT

  • ECE 303 Page 1

    LABORATORY MANUAL ECE 303

    Unified Electronics Lab-III

  • ECE 303 Page 2

    Sr No.

    Title of the Experiment Page No.

    1. To develop program for linear convolution and correlation using MATLAB. 3

    2. To develop a program for computing circular convolution Using MATLAB. 6

    3. To develop a program for computing DFT and IDFT using MATLAB. 8

    4. To develop a program for computing inverse Z-transform using MATLAB. 11

    5. To develop a program for designing FIR Filter in MATLAB. 13

    6. To develop a program for designing IIR Filters in MATLAB. 16

    7. To generate a FM Signal and measure Depth of modulation. 18

    8. To obtain Amplitude modulated envelope and determine depth of modulation 21

    9. To study envelope detector for demodulation of AM signal and observe diagonal peak clipping effect. 24

    10. Design Hartley oscillator and determine lowest and highest frequency it can generate. 26

    11. Design and observe waveforms of colpitts oscillator, compare its characteristics with Hartley oscillator.

    28

    12. Design RC phase shift oscillator and determine lowest and highest frequency it can generate. 30

  • ECE 303 Page 3

    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. Enter the input Sequence, x having length=4 2. Enter the Impulse Sequence, h having length=4 3. Performing the Convolution, store the value in y 4. Plotting the Input Sequence. 5. Plotting the Impulse Sequence. 6. 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

  • ECE 303 Page 4

    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 5

    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 input sequence 2

    4 6

    3

    4

    2

    2

    1

    0

    0

    1 2 3 4 1 2 3 4

    output sequence

    40

    30

    20

    10

    0

    0 2 4 6 8

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

  • ECE 303 Page 6

    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) & h(n) is y(n):');

    if(a>b) n=a;

    else n=b;

    end if(a-b~=0)

    if(a>b) h=[h,zeros(1,a-b)];

    else x=[x,zeros(1,b-a)];

    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 7

    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 8

    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 9

    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 10

    For IDFT

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

  • ECE 303 Page 11

    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 Z-transform 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 Z-Transform 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 12

    4. Required Results:

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

  • ECE 303 Page 13

    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 14

    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 15

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

  • ECE 303 Page 16

    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 17

    3. Required Results:

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

  • ECE 303 Page 18

    Experiment -7

    1. 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. Learning Objectives: To implement the concept of Frequency modulation (already taught).

    3. 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 19

    5. Required Results:

  • ECE 303 Page 20

    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 21

    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. Outline of the Procedure: a) Connect the circuit as per the given circuit diagram. b) Apply fixed frequency carrier signal to carrier input terminals. c) Apply modulating signal from function generator of 0.8VP-P of 1KHz.

    d) 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 22

    5. Required Results:

  • ECE 303 Page 23

    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 24

    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 25

    6. Observation Table:

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

  • ECE 303 Page 26

    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.

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

    3. Circuit Diagram:

    4. Outline of the Procedure:

    a) Connect the circuit as shown in figure. b) Connect CRO at the output terminal.

    c) Observe the output of the oscillator on a CRO, d) Note down the repetition period (T) of observed signal. Compute f o== 1/T e) Calculate the theoretical frequency of the circuit using the formulae.

  • ECE 303 Page 27

    5. Observation Table:

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

  • ECE 303 Page 28

    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, resistor-56kohm, supply voltage, CRO.

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

    3. Circuit Diagram:

    4. Outline of the Procedure:

    a) Connect the circuit as shown in figure. b) Connect CRO at the output terminal. c) d) Observe the output of the oscillator on a CRO, e) 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 29

    5. Observation Table:

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

  • ECE 303 Page 30

    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 31

    4. Outline of the Procedure:

    a) Connect the circuit as shown. b) S wi t c h o n t h e p o we r s u p p l y . c) Connect the CRO at the output of the circuit. d) Adjust the RE to get undistorted waveform. e) Measure the Amplitude and Frequency. f) 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.