0% found this document useful (0 votes)
24 views

Help Help Help Diary Diary Help Help Demo

This document provides an introduction to MATLAB by outlining 7 exercises for students to complete. The exercises include: 1) Learning basic MATLAB commands like help and diary 2) Trying built-in demos to learn basic concepts 3) Reviewing sections of the MATLAB tutorial 4) Performing operations like matrix multiplication on sample vectors 5) Plotting a continuous time function by sampling it 6) Using subplot to show two plots on one page 7) Performing complex number computations Students are instructed to complete the exercises, show their work, and turn in a neatly organized report with annotated results.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Help Help Help Diary Diary Help Help Demo

This document provides an introduction to MATLAB by outlining 7 exercises for students to complete. The exercises include: 1) Learning basic MATLAB commands like help and diary 2) Trying built-in demos to learn basic concepts 3) Reviewing sections of the MATLAB tutorial 4) Performing operations like matrix multiplication on sample vectors 5) Plotting a continuous time function by sampling it 6) Using subplot to show two plots on one page 7) Performing complex number computations Students are instructed to complete the exercises, show their work, and turn in a neatly organized report with annotated results.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Introduction to MATLAB

In this lab, we will begin to use MATLAB. You must hand in everything
that is underlined.
1. Learn how to invoke MATLAB and familiarize yourself with the help
command. Typing help gives you a list of all help topics. Typing
help topic gives help on speci c MATLAB function. Use the help
command to learn about the diary command. Use the diary com-
mand to produce a text le containing the results of typing help help.
Hand in a hardcopy of this le.
2. Be sure to try some of the built-in demos in matlab. Type demo to see
the choices. Try out the ones on basic MATLAB commands such as
convolution.
3. Scan the following sections of the MATLAB tutorial
(http://www.isr.umd.edu/~austin/ence202.d/matlab.html):
 Getting Started
 Variables
 Variable Arithmetic
 Matrices
4. Perform the following operations in MATLAB:
(a) Generate the following column vectors as MATLAB variables:
" # " #
x = 4 ; y = 68
2

(b) Using the computer, issue the following MATLAB commands:


(Turn in a diary of the result of each command).
i. x * y'
ii. x' * y
iii. x .* y
(c) Answer the following questions:
i. Justify the dimension of the matrix produced by each of the
above commands.
ii. Illustrate your answer by computing each result by hand.
5. In this exercise, we will learn to plot a continuous-time function by
creating a MATLAB vector of samples of the function.
Let x(t) = A cos(2f0t), where A = 20 volts and f0 = 1 MHz. We wish
to form the MATLAB vector of samples of x(t) as
y[n] = x(nTs);
where T is chosen such that we get exactly 12 samples/period of x(t).
(a) Create a MATLAB vector y containing samples (at 12 samples/period)
of 10 periods of x(t). (Therefore, your vector should have a total
of 120 elements.)
(b) Plot the vector y. Label both axes and title the plot. Hint: read
the MATLAB help for the commands plot, xlabel, ylabel, and
title.

6. Generate new vector representing the signal


z(t) = x2 (t)
Using the MATLAB subplot command, produce a single page con-
taining the following two plots:
(a) x(t) (Top plot)
(b) z(t) (Bottom plot)
Again, be sure to label all axes of both plots.
7. One of the strengths of MATLAB is that most of its commands work
with complex numbers. Perform the following computations in MAT-
LAB:
(a) Compute the value of j j . Is the result what you expect?
(b) Using the polyval command, evaluate the polynomial
P (x) = 4 + 3x3 , (1 , j )x
at x = j j .
The lab assignment should be neatly completed and turned in as a report
with all questions answered. The report need not be typed but should be
clear and easy to follow. All graphs and other MATLAB results should be
annotated (it is acceptable to annotate by simply writing on the printouts)
with the question number to which they refer.

You might also like