CT20and20DT20signals20chapter20220master20file1[1]

Embed Size (px)

Citation preview

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    1/18

    Continuous and Discrete Time

    Signals

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    2/18

    0 20 40 60 80 100

    -10

    0

    10

    t (ms)

    0 10 20 30 40 50-10

    0

    10

    n (samples)

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    3/18

    Plot and step functions

    plot (x,y) stem (x,y)

    Where: x - horizontal axis (vector)

    y

    vertical axis (vector)***x and y must have the same length

    t n

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    4/18

    square(t,duty)

    >> t = 1:100;

    >> y = square(t,80);

    >> plot(t,y)

    2*pi

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    5/18

    Fs = 20000;

    F = 1000;

    f = F/Fs;

    dc = 50;Amp = 1;

    t = 0:1/Fs:0.005;

    x = Amp*square(2*pi*F*t,dc)

    plot(t,x);

    T = 1/1000

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    6/18

    sawtooth(t) generates a sawtooth wave with

    period 2pi for the elements of time vector t.

    t = -10:0.1:10;A = 1;

    y = A*sawtooth(t);

    plot(t,y);

    2*pi

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    7/18

    t = -10:0.1:10;

    A = 1;w = xx ;

    y = A*sawtooth(t,w);

    plot(t,y);

    sawtooth(t, width)

    W = 0 W = 0.5

    W = 1

    2*pi 2*pi

    2*pi

    If no w is included it

    will use a default w =1

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    8/18

    Fs = 20000;

    F = 1000;

    f = F/Fs;

    Amp = 1;

    t = 0:1/Fs:0.005;

    x = sawtooth(2*pi*F*t)

    plot(t,x);

    T = 1/1000

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    9/18

    tripults(t,w)

    t = -5:0.1:5;

    w = 4;

    y = tripuls(t,w);

    plot(t,y);

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    10/18

    sinc(t) sinc(t) = sin(pi*t)/(pi*t)

    t = -5:.01:5;

    plot(t,sinc(t))

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    11/18

    The square wave contains a fundamental and a

    series of ODD HARMONICS that is harmonics which

    are odd number multiples of the fundamental (x3

    x5 x7 etc.) These are called the 3rd harmonic, 5th

    harmonic etc.

    SQUARE WAVE

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    12/18

    TRIANGULAR WAVE

    The triangular wave also contains a fundamental

    and a series of ODD HARMONICS, but in this case,

    each successive harmonic component starts off in

    the opposite PHASE to the previous one. i.e. the 3rd

    harmonic starts by going positive the 5th harmonic

    begins by going negative, the 7thpositive and so on.

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    13/18

    SAWTOOTH WAVE

    The sawtooth wave contains a fundamental

    and both ODD and EVEN HARMONICS.

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    14/18

    Fs = 20000;

    F = 1000;

    f = F/Fs;

    t = 0:99;

    Amp = 5;

    x = Amp*sin(2*pi*f*t);stem(t,x);

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    15/18

    Fs = 20000;

    F = 1000;f = F/Fs;

    n = 0:99;

    Amp =5;

    wnoise = 1.5 + sqrt(0.5)*randn(size(n));

    x = Amp*sin(2*pi*f*n);

    y = wnoise+x;subplot(3,1,1);stem(n,x);

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

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

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    16/18

    Fs = 20000;

    F1 = 1000;

    F2 = 3000;

    F3 = 5000;

    n = 0:99;

    wnoise = sqrt(0.2)*randn(size(n));

    x1 = sin(2*pi*n*F1/Fs);

    x2 = sin(2*pi*n*F2/Fs);

    x3 = sin(2*pi*n*F3/Fs);x4 = sin(2*pi*n*F3/Fs);

    s= x1 + x2 + x3 + wnoise;

    sf = fft(s,512);

    w = (0:255)/255*(Fs/2);

    plot(w,abs(sf(1:256)));

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    17/18

    Fs = 20000;

    F1 = 1000;

    F2 = 3000;

    F3 = 5000;

    n = 0:99;

    wnoise = sqrt(0.2)*randn(size(n));

    x1 = sin(2*pi*n*F1/Fs);

    x2 = sin(2*pi*n*F2/Fs);

    x3 = sin(2*pi*n*F3/Fs);x4 = sin(2*pi*n*F3/Fs);

    s= x1 + x2 + x3 + wnoise;

    sf = fft(s,512);

    w = (-255:255)/255*(Fs/2);

    plot(w,abs(sf(1:511)));

  • 7/28/2019 CT20and20DT20signals20chapter20220master20file1[1]

    18/18

    Fs = 20000;

    F = 1000;f = F/Fs;

    t = 0:1/Fs:0.005;

    Amp = 5;

    x = Amp*sin(2*pi*F*t);

    plot(t,x)