Lab 0b Introduction to Simulink by Emmure

VIEWS: 26 PAGES: 8

									ECEN
448:
Real‐time
DSP,
Lab
0b,
Texas
A&M
University
(Fall
2009),
Instructor:
Dr.
D.
Kundur
      Page
1
of
1





Lab 0b: Introduction to Simulink
                                  TA: Ms. Shan Liu, Instructor: Dr. Deepa Kundur


Objectives of this Lab
         This lab in ECEN 448 aims to:

              •    Introduce the Simulink software environment, which is an integral software tool for
                   developing DSP algorithms and for programming the DSP hardware for this course.

              •    Through the prelab component, this lab reviews fundamental real-time DSP concepts
                   covered in the lectures that you are responsible for on tests.


Prelab
         Part A: You must read this lab ahead of time and come prepared to conduct the online Simulink
tutorial. It is necessary that you complete Lab 0a prior to conducting this lab. You must each bring a
printed version of this lab to your lab session with solutions to the prelab questions (see below) written in
the given spaces.

         Part B: Answer the prelab questions related to the course background PRIOR to coming to your
lab session. For full points, please do not only list answers.




Deliverables
         You must be present and conducting the interactive tutorial assigned to you during the scheduled
lab session. You must provide answers to the lab questions (at the end of these sheets). Please write
directly on the sheets and hand in your solutions by the end of the lab.




Grading and Due Date
        The answers to the lab questions (prelab and deliverables) are due to the TA by the end of this
lab. After grading, the TA will return it to you in a subsequent lab.
ECEN
448:
Real‐time
DSP,
Lab
0b,
Texas
A&M
University
(Fall
2009),
Instructor:
Dr.
D.
Kundur
    Page
2
of
2




                 Your Name:___________________________________ UIN:________________________


Prelab Questions

       Please use the given space on these sheets to answer the following questions related to the course
background so far (this must be done PRIOR to coming to your lab session):

1. You are using an n-bit signed integer fixed-point format to represent a number x. Suppose you double
   the number of bits used to represent x, so that it is now 2n. By what factor (as a function of n) does
   the range of numbers increase? It will help to do this problem using the following steps:

         a. What is the range of numbers represented by an n-bit signed integer fixed-point format
            number? Note the range of x is the number of all possible integers that it can represent, so if
            -A ≤ x ≤ B where A, B are positive integers then the range of x is A+B+1. Another way to
            think of this is to answer, how many different integers can an n-bit signed integer fixed-point
            format represent?




         b. Compute the above range assuming 2n-bits are used to represent the same format number.




         c. Determine the ratio if your answer in part b to your answer in part a.




2. You are using an n-bit signed fractional fixed-point format to represent a number x.

         a. Suppose you double the number of bits used to represent x, so that it is now 2n. By what
            factor (as a function of n) does the precision increase?




         b. Suppose you are using n = 4. You would like to increase precision by a factor of at least six
            by increasing the number of bits. What is the minimum number of bits required to increase
            precision in this way? Please show all steps and reasoning for full points.
ECEN
448:
Real‐time
DSP,
Lab
0b,
Texas
A&M
University
(Fall
2009),
Instructor:
Dr.
D.
Kundur
   Page
3
of
3




3.       Assume you are using unsigned integer fixed-point format to represent samples of a signal. Show
     that the dynamic range of this signal increase by approximately 6 dB for each additional bit used to
     represent its value. It will help to do this problem using the following steps:

         a. What is the dynamic range (ratio of maximum value to minimum non-zero value) of a
            number represented using n-bit unsigned integer fixed-point format? Show your work for full
            points. Please present your answer as a ratio value (i.e., not in dB).




         b. Approximate your answer in part a above for large n. That is, what terms can you neglect?




         c. Present your answer to part b above in units of dB.




         d. Show how increasing the number of bits to n+1 will result in approximately a 6 dB increase
            in dynamic range. Please explain thoroughly for full points.




4. You are using an n-bit floating-point format representation with a k-bit mantissa (with fractional
   representation).

         a. As conducted during the lecture, compute the precision of this format as a percentage
            resolution. Your answer should be a function of k, or n, or both.




         b. By what factor does the precision improve (i.e., decrease) for each additional bit used in the
            mantissa?
ECEN
448:
Real‐time
DSP,
Lab
0b,
Texas
A&M
University
(Fall
2009),
Instructor:
Dr.
D.
Kundur
     Page
4
of
4





Lab 0b: Introduction to Simulink
Introduction and Background
        This lab introduces you to the Simulink software environment. One main advantage of using
Simulink is that it helps a DSP engineering better integrate the design phase (in software) and
implementation phase (in hardware) steps of DSP system development resulting in more effective
algorithms for a given application. As you will learn, the Simulink environment is user-friendly and
provides a nice graphical user interface (GUI) to provide better intuition to a DSP designer.


Lab Instructions
         Go online to:

http://www.mathworks.com/academia/student_center/tutorials/simulink-launchpad.html

and select the “Interactive Simulink Tutorial”. You will need to register for this tutorial, which will take
approximately 90 minutes to complete.


Deliverables
         You must be present and conducting the interactive tutorial assigned to you during the scheduled
lab session. You must provide answers to the following questions. Please write directly on the sheets and
hand in your solutions by the end of the lab.
ECEN
448:
Real‐time
DSP,
Lab
0b,
Texas
A&M
University
(Fall
2009),
Instructor:
Dr.
D.
Kundur
     Page
5
of
5




                 Your Name:___________________________________ UIN:________________________

You must each separately answer the following questions on these lab sheets to be submitted (to the TA)
at the end of the lab. You may use the back of the sheets if necessary.


Lab Questions:

1. Match the appropriate actions to the descriptions below (there is an enumerated action pool for your
   reference). Please write the appropriate number from the action pool just left of each description
   below:

    a. Drag a block to the model window using the left mouse button OR select COPY and PASTE
       from EDIT menu.

    b. Hold down the CTRL key and select a block using the left mouse button, drag the block to a new
       location.

    c. Double mouse click on a block.

    d. CTRL-F.

    e. CTRL-R.

    f.   Mouse click on block's label and position the cursor to desired place.

    g. Hold down the SHIFT key and drag a block to a new location.

    h. Hold down the SHIFT key while dragging a block using the left mouse button.

    i.   Move the cursor to the line to where you want to create a vertex and use the left mouse button to
         drag the line while holding down the SHIFT key




                   Action pool:

                   1. Flip a block
                   2. Duplicating blocks in a model
                   3. Dividing a line
                   4. Rotate a block (clockwise 90 deg @ each keystroke)
                   5. Copying a block from a library
                   6. Display block's parameters
                   7. Changing blocks' names
                   8. Disconnecting a block
                   9. Drawing a diagonal line
ECEN
448:
Real‐time
DSP,
Lab
0b,
Texas
A&M
University
(Fall
2009),
Instructor:
Dr.
D.
Kundur
   Page
6
of
6





2. Find the following blocks from the Simulink library browser and write down the specific library
   names corresponding to each:

         a. Step

         b. Gain

         c. Sum

         d. Integrator

         e. Scope

         f.   To workspace

         g. Ramp

         h. Constant

         i.   Product

         j.   Trigonometry Function

         k. Mux



3. Consider the following sinusoid: x(t)=Acos(!t+ϕ) where the radian frequency is 5 rad/s, the phase is
   π/2 and A = 2.

         a. Use Simulink to generate/model this signal. Please quickly sketch the Simulink block
            diagram below.




         b. What is the corresponding MATLAB code to obtain the same output?
ECEN
448:
Real‐time
DSP,
Lab
0b,
Texas
A&M
University
(Fall
2009),
Instructor:
Dr.
D.
Kundur
   Page
7
of
7





Multiple Choice Section

Please circle the best answer for each of the next three questions.

4. To use MATLAB variables as Simulink block parameters, where do you need to define their values?



         A. Simulink library browser

         B. Simulink model editor

         C. MATLAB current directory

         D. MATLAB workspace



5. Given a discrete multirate system using the fixed step solver, what would the fundamental sample
   time be if the blocks in the model were sampled at 0.5 and 0.8?



         A. 0.1

         B. 0.3

         C. 0.5

         D. 1.2



6. What MATLAB command configures the Simulink environment prior to creating any Signal
   Processing Systems?



         A. >>sim

         B. >>simulink

         C. >>dspstartup

         D. >>commstartup
ECEN
448:
Real‐time
DSP,
Lab
0b,
Texas
A&M
University
(Fall
2009),
Instructor:
Dr.
D.
Kundur
   Page
8
of
8




Please circle all appropriate answers for each of the next two questions.

7. What are the advantages of importing inputs from MATLAB and exporting outputs to the MATLAB
   workspace? (Select all that apply)

         A. Simulation results can be visualized with a wide variety of MATLAB plotting functions.

         B. You can import actual physical data into your model.

         C. Simulation results can be analyzed further in MATLAB.

         D. You can drag blocks from the Simulink Library Browser into the MATLAB workspace.



8. What are the possible ways to create a subsystem? (Select all that apply)

         A. Select blocks in a model and group them into a subsystem.

         B. Select blocks in a model and type “subsystem” in the command window.

         C. Drag a subsystem block into a model, and add blocks to the subsystem window.

         D. Drag variables from MATLAB workspace as a group into a Simulink model




9. Consider the transfer function:

                                                            1
                                                          2
                                                                     .
                                                       2s + 0.7s + 1
Build a Simulink block of the above system where the input signal is a unit step function.

         a. Display the output from 0 to 10.0 time units and sketch your results.
                                  €




         b. Repeat above for an output from 0 to 50.0 time units.

								
To top