Lab 1 Finished!

download Lab 1 Finished!

of 15

Transcript of Lab 1 Finished!

  • 8/18/2019 Lab 1 Finished!

    1/15

    Abstract

    Based on the title, Discrete and Continuous time Signal and Convolution, we will be

    introduced to the Matlab commands to create a discrete and sinusoidal waveform by a specific

    function and variety data. Then, we will be taught to convolute two functions.

    Objective

    The purpose of this task is to illustrate the properties of continuous and discretetime

    signals using Matlab software environment.

    Project background

    Continuous time signal is a signal that will contain a value for all real number along the

    time a!is. "n contrast for discrete time signal which created by sampling a continuous signal.

    Means that only have values at specific time with an e#ually interval for each times.

    Convolution is a mathematical operation on two functions that will produce a third

    function that has been modified by combination of those two earlier functions.

     

    Procedures

    Task 1

    Two set of command was typed in the Matlab software. The output waveform was observed and

    analy$e.

    a% &isting '

  • 8/18/2019 Lab 1 Finished!

    2/15

     b% &isting (

    Task 2

    ) set of command was written in the Matlab command window with a sampling fre#uency,

    fundamental fre#uency and amplitude was given.

  • 8/18/2019 Lab 1 Finished!

    3/15

    The same command was written on the Matlab command window but the value of amplitude,

    fundamental fre#uency and sampling fre#uency was changed twice.

    *irst

    Second

  • 8/18/2019 Lab 1 Finished!

    4/15

    Task 3

    ) command was written for given function with a specified intervals. The waveform of the

    function was observed and analy$e.

    a% sinc+t% in '-pi, '-pi / rect+t% in (, (

    Then, a command to create a discretetime function was written with function of a^n(u(n))-u(n-

    10)) in -20, 20]

  • 8/18/2019 Lab 1 Finished!

    5/15

    Task

    ) command to obtain a discrete time convolution waveform was written. The waveform was

    observed and analy$e.

  • 8/18/2019 Lab 1 Finished!

    6/15

    !esu"t and #iscussion

    Task 1

    0 10 20 30 40-1

    -0.8

    -0.6

    -0.4

    -0.2

    0

    0.2

    0.4

    0.6

    0.8

    1

    $oding

    n0-1(12-3 4describing array

    y0sin+n/2%3 4declaration of variable to sin function

    subplot+5,','%3 4located the output

    stem+n,y%3 4display discrete data

    %uestion 1

     Explain the effect of each command in Listing 1. You may need to draw, sketch or print out

    any figures graphs in your explanation?

    *or the first command, it was describing a group of arrayfrom - to 2- with an increment

    of (. The ne!t line commanded the declaration of a variable e#ual to sin function. Third

    command will located the output waveform by respecting to the matri! command. &ast

    command is about to display discrete se#uence data.

  • 8/18/2019 Lab 1 Finished!

    7/15

    %uestion 2

    From your obseration, is listing 1 generating a continuous!time or discrete!time signal?

    Discretetime signal data data will be generate because the data use command of 6stem7.

    %uestion 3 (coding)

    n'0-1(12-3 4"For the first command, it is describing a group of array from # to $# with an

    increment of %&

    $0sin+n'/2%3 4"second line command is about declaration of sin function which an array that

    has been set up before as ariable of the function&

    subplot+5,','%3 4"by respecting to the matrix command , it will located the output waeform&

     plot+n',$%3 4"show that connection of plot point to be able display signal which looks like a

    continuos time signal&

    n(0-1'-12-3 4"'t is describing a group of array from # to $# with an increment of %&

    w0sin+n(/2%3 4"'s about declaration of sin function which an array that has been set up

    before as ariable of the function&

    subplot+5,',5%3 8 4"by respecting to the matrix command , it will located the output waeform&

     plot+n(,w%3 4"show that connection of plot point to be able display signal which looks like a

    continuos time signal&

    %uestion

     (lot the graph obtained from the command aboe?

    0 10 20 30 40-1

    -0.5

    0

    0.5

    1

    0 10 20 30 40-1

    -0.5

    0

    0.5

    1

  • 8/18/2019 Lab 1 Finished!

    8/15

    Task 2

    %uestion &

     (lot the graph obtained from the commands in Listing )?

    0 0.5 1 1.5 2 2.5 3 . .

     

    -1

    -0.5

    0

    0.5

    1plot of a cosine waveform

         A    m    p     l     i     t    u     d    e

    time

    0 5 10 15 20 25-1

    -0.5

    0

    0.5

    1plot of a cosine waveform

         A    m

        p     l     i     t    u     d    e

    samples

    $oding and e'"anation

    Clc3

    clf3

     90583 4"declaration of ariable with its own alue&)0'3 4"declaration of ariable with its own alue&

    fl0'---3 4"declaration of ariable with its own alue&fs0:---3 4"declaration of ariable with its own alue&

    ts0'/fs3 4"declaration of ariable with mathematical operation& t0-1ts19;ts3 4"describing a group of array with beginning, increment and ending alue&

    !0);cos+(;pi;fl;t%3 4+declaration of ariable with cos function&

    figure+'%3subplot+(,','%3plot+t,!%3 4"located and plot the waeform&title+

  • 8/18/2019 Lab 1 Finished!

    9/15

    %uestion

    +rite a program in -L-/ with different fundamental fre0uency and sampling fre0uency?

    a%

    0 0.5 1 1.5 2 2.5 3 . .

     

    -1.5

    -1

    -0.5

    0

    0.5

    1

    1.5plot of a cosine waveform

         A    m    p     l     i     t    u     d    e

    time

    0 5 10 15 20 25-1.5

    -1

    -0.5

    0

    0.5

    1

    1.5plot of a cosine waveform

         A    m    p     l     i     t    u     d    e

    samples

    $oding and e'"anation

    clc3

    clf3 90583 4"declaration of ariable with its own alue&

    )0'.83 4"declaration of ariable with its own alue&

    fl0'8--3 4"declaration of ariable with its own alue&fs0:---3 4"declaration of ariable with its own alue&ts0'/fs3 4"declaration of ariable with mathematical operation&

     t0-1ts19;ts3 4"describing a group of array with beginning, increment and ending alue&!0);cos+(;pi;fl;t%3 4+declaration of ariable with cos function&figure+'%3subplot+(,','%3plot+t,!%3 4"located and plot the waeform&

    title+

  • 8/18/2019 Lab 1 Finished!

    10/15

     b%

    0 0.5 1 1.5 2 2.5 3 . .

     

    -2

    -1

    0

    1

    2plot of a cosine waveform

         A    m    p

         l     i     t    u     d    e

    time

    0 5 10 15 20 25-2

    -1

    0

    1

    2plot of a cosine waveform

         A    m    p     l     i     t    u     d    e

    samples

    $oding and e'"anation

    clc3

    clf3 90583 4"declaration of ariable with its own alue&

    )0(3 4"declaration of ariable with its own alue&

    fl0(---3 4"declaration of ariable with its own alue&fs0:---3 4"declaration of ariable with its own alue&ts0'/fs3 4"declaration of ariable with mathematical operation&

     t0-1ts19;ts3 4"describing a group of array with beginning, increment and ending alue&!0);cos+(;pi;fl;t%3 4+declaration of ariable with cos function&figure+'%3subplot+(,','%3plot+t,!%3 4"located and plot the waeform&

    title+

  • 8/18/2019 Lab 1 Finished!

    11/15

    Task 3

    %uestion *

    +rite the commands you used in soling the problem pecial Function?

    +)%

    -40 -30 -20 -10 0 10-0.5

    0

    0.5

    1

    -2 -1.5 -1 -0.5 0 0.5 .0

    0.5

    1

    t0'-;pi1-.'1'-;pi3 4"describing a group of first array from !1#pi to 1#pi with an increment#f #.1&

    s0(1-.'1(3 4"describing a group of second array from !% to % with an increment #f #.1&

    y0sinc+t%3 4"declaration of ariable respect with a sinc function&$0+abs+s%=0-.8%3 *"declaration of ariable by computing that mathematical function&

    subplot+5,',(%3plot+t,y%3 *"located and plot the waeform&subplot+5,',5%3plot+s,$%3 *"located and plot the waeform&

  • 8/18/2019 Lab 1 Finished!

    12/15

    +B%

    -20 -15 -10 -5 0 50

    0.2

    0.4

    0.6

    0.8

    -20 -15 -10 -5 0 50

    0.5

    1

    -20 -15 -10 -5 0 50

    20

    40

    60

    u0inline+-

  • 8/18/2019 Lab 1 Finished!

    13/15

    +C%

  • 8/18/2019 Lab 1 Finished!

    14/15

    Task

    0 5 10 150

    0.5

    1

    1.5

    2

        x     (    n     T     )

    0 5 10 150

    0.5

    1

    1.5

    2

         h     (    n     T     )

    $oding

    !0- ' ' ' ' ' ' ' ' ' ' ' ' '3h0' -.8 -.(8 -.'(8 -.-2(83

    y0conv+!,h%3

    n$0'-3ly0length+y%@n$3

    !$0!,$eros+',lylength+!%%3

    h$0h, $eros+',lylength+h%%3

    y$0y, $eros+',n$%3nn0-1ly'3 

    subplot+5,','%,stem+nn,!$,

    !label+

  • 8/18/2019 Lab 1 Finished!

    15/15

    and continuous signal. Besides, we achieve to obtain a discrete time convolution

    using Matlab and manually.