Intro to Simulink

Embed Size (px)

Citation preview

  • 8/13/2019 Intro to Simulink

    1/12

    EE 2170

    Design and Analysis of Signals and Systems

    Instructor: Carlos Davila

    Dept. of Electrical Engineering Sout!ern "et!odist #niversity

    $a%oratory &: Introduction to Simulin'(Dou%le Side%and

    )DS*+ "odulation,Demodulation

    In lecture we have been studying the spectrum (both line spectrum for periodic signals

    and Fourier Transform spectrum for non periodic signals). We have also begun to look atfilters and how these affect the frequency distribution of signals which pass through

    them. In this lab we will apply what we have been studying in lecture to double sideband

    modulation (!"). ouble sideband and related modulation techniques are used

    e#tensively in wireless wireless communications applications such as cell phones. $

    general modulation system is shown below. The baseband signal (speech% audio% data) isshifted up in frequency to a radio frequency (&F) band by the transmitter. The &F signal

    is then sent via the transmitting antenna through the wireless channel to the receivingantenna. For e#ample in a cellular phone uplink the transmitter is in the handset and the

    receiver is the cellular base station (or vice versa for the downlink).

    This laboratory will look at modulation while at the same time give you a hands on

    introduction to the use of !imulink. Things that should be recorded during this lab andput in the lab writeup web page appear highlighted in yellow. "egin by clicking on the

    'atlab icon to run 'atlab. The 'atlab interface looks like this

    Transmitter &eceiver

    transmitting

    antenna

    receiving

    antenna

    speech

    audiodata

    wireless

    channel (air)

    http://www.engr.smu.edu/~cdhttp://www.seas.smu.edu/ee/index.htmlhttp://www.smu.edu/http://www.seas.smu.edu/ee/index.htmlhttp://www.smu.edu/http://www.engr.smu.edu/~cd
  • 8/13/2019 Intro to Simulink

    2/12

    In the 'atlab command window% type *simulink* followed by return. $fter !imulinkloads% you will see a window that looks like this

  • 8/13/2019 Intro to Simulink

    3/12

    +e#t% click on the blank page icon in the !imulink ,ibrary "rowser% this opens up an

    additional window where you can build !imulink models. This first lab will consist of

    putting together some simple models of signal generators. We will then view the signalsin both the time and frequency domain. -lick on the ** sign ne#t to *!imulink* in the

    ,ibrary "rowser then click on *!ources*% you should see the following

  • 8/13/2019 Intro to Simulink

    4/12

    !croll down until you see the !ine Wave icon and drag that icon to the blank model

    window. +e#t click on *!inks* in the left part of the ,ibrary "rowser and drag the

    *!cope* icon to the model window. The model window should now look like this

  • 8/13/2019 Intro to Simulink

    5/12

    +e#t% connect a *wire* between the !ine Wave generator and the !cope. This can be doneby dragging the mouse from the sinewage icon output terminal to the !cope icon input

    terminal. ouble click on the !cope icon% this will cause an oscilloscope screen to appear.$n osciloscope is a device which enables one to view the appearance of a signal. +e#t goto the model window and from the *!imulation* menu% select *!tart*. /ou should then

    see the following on the !cope screen

    +ote the length of the simulation is 01 seconds. The scope can plot multiple channels atone time% in the !cope window% click on the *parameters* icon and set the number of a#es

    to 2. $ second plot window should appear and a second input terminal should also appearon the !cope icon. +e#t go back to the *!ources* pallette and drag the square wave

    generator to the model window. Then connect the square wave generator to the second

    input in the !cope icon

  • 8/13/2019 Intro to Simulink

    6/12

    &un the simulation again% how many cycles of the square wave appear in the scopewindow3 What is its period3 Include a copy of your plot in your writeup. This can be

    done by pressing the *$lt* and *4rint !crn* keys simultaneously to copy the activewindow to the notepad% then paste the image into your Word document.

    +e#t put together the following model. The !ignal 5enerator can be found in the*!imulink6!inks* area of the !imulink ,ibrary "rowser and the *4ower !pectral

    ensity* block can be found under *!imulink 7#tras6$dditional !inks*.

    ouble click on the *!ignal 5enerator* block and set its parameters as follows

  • 8/13/2019 Intro to Simulink

    7/12

    !imilarly% set the parameters of the *4ower !pectral ensity* block to

    The power spectral density block plots the squared magnitude of the Fourier Transform

    of the signal connected to its input. It does this by sampling its input every 1.10 seconds%then computing an appro#imation to the Fourier Transform called the FFT (which we8ll

    discuss later in 77 29:1). +e#t run the simulation and paste the resulting graph in your

    writeup (you may need to resi;e it first).

  • 8/13/2019 Intro to Simulink

    8/12

    Transforms of a modulated signal. $dd a multiplier (from the *!imulink6'ath* area of

    the !imulink ,ibrary "rowser) and a *!ine Wave* generator from the

    *!imulink6!ources* area of the ,ibrary "rowser

    This is called a ouble !ideband 'odulator and is the basis for many radio

    communications systems. The signal being modulated (typically voice% data% or musicfrom a radio station) is the output of the !ignal 5enerator (a square wave here)% and the

    !ine Wave output is the *carrier signal*% which is typically at a much higher frequency

    than the signal being modulated. !et the parameters of the !ine Wave generator to

  • 8/13/2019 Intro to Simulink

    9/12

    and run the simulation (making sure that the *4ower !pectral ensity* sample time is still

    set to 1.110). 4aste the plots to your writeup and e#plain the appearance of the FourierTransform of the modulator output. The modulator output is the signal which is

    transmitted to a receiver. It is up to the receiver to recover (in this case) the square wave

    from the modulator output. This can be done by first translating the signal back to itsoriginal frequency (baseband) and lowpass filtering the received signal. $dd another !ine

    Wave generator having the same frequency as the carrier frequency as well as a second

    multiplier and connect them as shown below

  • 8/13/2019 Intro to Simulink

    10/12

    The second !ine Wave and multiplier are a part of the demodulator of a communications

    system. &un this simulation% record the resulting plots in your writeup and e#plain yourresults. To complete the demodulator% we must add a lowpass filter to the output of the

    multiplier.

    $ lowpass filter is a filter which passes only low frequencies. !etting the cutoff

    frequency to one=half the carrier frequency will do the trick. $dd a lowpass filter asfollows

  • 8/13/2019 Intro to Simulink

    11/12

    The parameters of the *Transfer Fcn* block should be set to

    +ow run the simulation. -opy the resulting plot of the receiver output into your writeupand e#plain your results. To look at the transfer function of the lowpass filter% use the

    'atlab *freqs("%$)* command with " > ?0@ and $ > ?06A11B2 sqrt(2)6A11 0@. $dd a

    plot of the lowpass filter transfer function to your writeup and indicate why the filter islowpass.

  • 8/13/2019 Intro to Simulink

    12/12