LAB NO.3 DISCRETE TIME SYSTEMS IN TIME DOMAIN IMPULSE RESPONSE OF LTI SYSTEM

download LAB NO.3 DISCRETE TIME SYSTEMS IN TIME DOMAIN IMPULSE RESPONSE OF LTI SYSTEM

of 5

Transcript of LAB NO.3 DISCRETE TIME SYSTEMS IN TIME DOMAIN IMPULSE RESPONSE OF LTI SYSTEM

  • 8/8/2019 LAB NO.3 DISCRETE TIME SYSTEMS IN TIME DOMAIN IMPULSE RESPONSE OF LTI SYSTEM

    1/5

    LAB NO.3

    DISCRETE TIME SYSTEMS IN TIME DOMAIN

    IMPULSE RESPONSE OF LTI SYSTEM

    Source Code:

    clf;

    N=40;

    Num=[2.2403 2.4908 2.2403];

    Den=[1 -0.4 0.75];

    Y=impz (Num,Den,N);

    stem(Y);

    xlabel('time index n');

    ylabel('amplitude');

    title('Impulse Response');

    grid;

    Output:

  • 8/8/2019 LAB NO.3 DISCRETE TIME SYSTEMS IN TIME DOMAIN IMPULSE RESPONSE OF LTI SYSTEM

    2/5

    CONVOLUTION PROCESS

    Source Code:

    %generate the input sequence

    n=0:40;

    a=2;b=-3;

    x1=cos(2*pi*0.1*n);

    x2=cos(2*pi*0.4*n);

    x=(a*x1)+(b*x2);

    num=[2.2403 2.4908 2.2403];

    den=[1 -0.4 0.75];

    ic=[0 0]; %set zero initial conditions

    y1=filter(num,den,x1,ic); %compute the output y1(n)

    y2=filter(num,den,x2,ic); %compute the output y2(n);

    y=filter(num,den,x,ic); %compute the output y(n);

    yt=(a*y1)+(b*y2);

    d=y-yt; %compute the difference output d[n]

    %plot the outputs and difference signal

    subplot(3,1,1);stem(n,y);

    ylabel('amplitude');

    title('output due to weighed input');

    subplot(3,1,2);stem(n,yt);

    ylabel('Amplitude');title('weighed output');

    subplot(3,1,3);stem(n,d);

    xlabel('time index n');title('difference signal');

    Output:

  • 8/8/2019 LAB NO.3 DISCRETE TIME SYSTEMS IN TIME DOMAIN IMPULSE RESPONSE OF LTI SYSTEM

    3/5

    CHECKING OF LINEAR OR NON-LINEAR SYSTEM

    Source Code:

    %generate the input sequence

    n=0:40;D=10;a=3.0;b=-2;

    x=a*cos(2*pi*0.1*n)+b*cos(2*pi*0.4*n);

    xd=[zeros(1,D) x];

    num=[2.2403 2.4908 2.2403];den=[1 -0.4 0.75];

    ic=[0 0];

    % compute the output y(n)

    y=filter(num,den,x,ic);

    %compute the output yd(n)

    yd=filter(num,den,xd,ic);

    %compute the difference output d[n]

    d=y-yd(1+D:41+D);

    %plot the outputs

    subplot(3,1,1);stem(n,y);

    ylabel('Amplitude');title('output y[n]');grid;

    subplot(3,1,2);stem(n,yd(1:41));

    ylabel('Amplitude');title('output due to delayed input');grid;

    subplot(3,1,3);stem(n,d);

    xlabel('time index n');ylabel('amplitude');

    title('Difference signal');grid;

    0 5 10 15 20 25 30 35 40-40

    -20

    0

    20

    amplitude

    output due to weighed input

    0 5 10 15 20 25 30 35 40-50

    0

    50

    Amplitude

    weighed output

    0 5 10 15 20 25 30 35 40

    -5

    0

    5x 10

    -15

    time index n

    difference signal

  • 8/8/2019 LAB NO.3 DISCRETE TIME SYSTEMS IN TIME DOMAIN IMPULSE RESPONSE OF LTI SYSTEM

    4/5

    Output:

    GENERATION OF DISCRETE TIME SIGNALS AND TO FIND THEIR DIFFERENCE

    clf;n=0:40;a=2;b=-3;

    x1=cos (2*pi*0.1*n);x2=cos (2*pi*0.4*n);x=(a*x1) + (b*x2);

    num=[2.2403 2.4908 2.2403];den=[1 -0.4 0.75];ic=[0 0];

    y1=filter (num,den,x1,ic);y2=filter (num,den,x2,ic);

    y=filter (num,den,x,ic);

    y3=(a*y1)+(b*y2);d=y-y3;

    subplot(3,1,1);stem(n,y);

    xlabel ('time domain representation');ylabel ('Amplitude');

    title ('output due to weighed input');grid;

    subplot (3,1,2);stem (n,y3);

    xlabel ('Time Index n');ylabel ('amplitude');title ('weighed output');grid;

    subplot (3,1,3);stem(n,d);

    xlabel ( 'time index n');

    ylabel ('amplitude');title ('Difference signal');grid;

    0 5 10 15 20 25 30 35 40-40

    -20

    0

    20

    Am

    plitude

    output y[n]

    0 5 10 15 20 25 30 35 40-50

    0

    50

    Amplitude

    output due to delayed input

    0 5 10 15 20 25 30 35 40-1

    0

    1

    time index n

    am

    plitude

    Difference signal

  • 8/8/2019 LAB NO.3 DISCRETE TIME SYSTEMS IN TIME DOMAIN IMPULSE RESPONSE OF LTI SYSTEM

    5/5

    Output:

    0 5 10 15 20 25 30 35 40-50

    0

    50

    time domain representation

    Amplitude

    output due to weighed input

    0 5 10 15 20 25 30 35 40-50

    0

    50

    Time Index n

    amplitude

    weighed output

    0 5 10 15 20 25 30 35 40-5

    0

    5x 10

    -15

    time index n

    amplitude

    Difference signal