DOC

experiment1

By Brittany Walker,2014-09-18 14:06
8 views 0
experiment uniform experiment milgram experiment latexperiment field experiment the experiment experiment with quasi experiment experiment garment sensual experiment

姓名 学号 班级

clear all

    %define the parameters in filter function

    A=[1,-0.9]; %the system vector parameters B=[0.05,0.05];

    x1_n=[1 1 1 1 1 1 1 1 zeros(1,50)]; %produce the signal x1(n)=R8(n) x2_n=ones(1,200); %produce the signal x2(n)=u(n)

    h_n=impz(B,A,100);

    subplot(3,1,1);stem(h_n,'r');

    ylabel=('h(n)');title('the unit impulz response h(n)'); %the unit impulz response y1_n=filter(B,A,x1_n); %the response of x1(n) subplot(3,1,2);stem(y1_n,'g');

    ylabel=('y1(n)'); title('the response of x1(n):y1_(n)');

    y2_n=filter(B,A,x2_n); %the response of x2(n) subplot(3,1,3);stem(y2_n,'b');

    ylabel=('y2(n)');title('the response of x2(n):y2(n)');

    the unit impulz response h(n)

    0.1

    0.05

    00102030405060708090100

    the response of x1(n):y1n)(

    1

    0.5

    00102030405060

    the response of x2(n):y2(n)

    1

    0.5

    0020406080100120140160180200

%define the parameters in conv function

    x1_n=[1 1 1 1 1 1 1 1 ]; %produce the signal x1(n)=R8(n) h1_n=[ones(1,10) zeros(1,20)];

    h2_n=[1 2.5 2.5 1 zeros(1,20)];

y21_n=conv(h1_n,x1_n);

    y22_n=conv(h2_n,x1_n);

    figure(2)

    subplot(2,2,1);stem(h1_n,'r'); %the unit impulz response ylabel=('h1(n)');title('the unit impulz response h1(n)');

    axis([0 30 0 1])

    subplot(2,2,2);stem(h2_n,'g');

    ylabel=('h2(n)');title('the unit impulz response h2(n)');

    axis([0 20 0 2.5])

    subplot(2,2,3); stem(y21_n,'c'); %the conv of h1(n) and R8(n) ylabel=('y21(n)');title('the conv of h1(n) and R8(n):y21(n)');

    axis([0 30 0 8])

    subplot(2,2,4);stem(y22_n,'b'); %the conv of h2(n) and R8(n) ylabel=('y22(n)');title('the conv of h1(n) and R8(n):y22(n)');

    axis([0 20 0 7])

    the unit impulz response h1(n)the unit impulz response h2(n)

    12.5

    0.82

    0.61.5

    0.41

    0.20.5

    00010203005101520

    the conv of h1(n) and R8(n):y21(n)the conv of h1(n) and R8(n):y22(n)

    8

    6

    6

    44

    22

    00010203005101520

    u_n=ones(1,200); %produce the signal u(n) n=0:250;

    x_n=sin(0.014*n)+sin(0.4*n); %produce the sine signal A=[1,-1.8237,0.9801]; %the system vector parameters B=[1/100.49,0,-1/100.49];

    y31_n=filter(B,A,u_n); %the response of u(n) y32_n=filter(B,A,x_n); %the response of sine signal figure(3)

    subplot(2,1,1);stem(y31_n, 'r');

    ylabel=('y31(n)');title('the response of u(n):y31(n)'); subplot(2,1,2);stem(y32_n, 'b');

    ylabel=('y32(n)');title('the response of sine signal:y32(n)');

    the response of u(n):y31(n)

    0.05

    0

    -0.05020406080100120140160180200

    the response of sine signal:y32(n)

    1

    0.5

    0

    -0.5

    -1050100150200250300

Report this document

For any questions or suggestions please email
cust-service@docsford.com