
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

ECE 2000 Exam #2 Name:__________________________
Fall 2003
Section ________ Grade:_________
Use the most concise Matlab statements to accomplish each task. Use the standard
numerical, NOT symbolic, methods (do NOT use SOLVE). Write very carefully, with clearly
identifiable spaces, commas, semicolons, parentheses, etc. Put all answers on YOUR paper.
Problem 1 [25 pts]. Write the shortest, most concise Matlab statements to accomplish
each of these tasks, given the following matrix definitions:
(a) As part of an M-file, prompt the user to enter a numerical value, from the keyboard, for
the scalar variable “speed”, then accept and store that value.
(b) In the command window, show the string “The value of speed is “, followed by the
current numerical value of the variable “speed”, followed by the string “meters per
second”.
(c) Replace the 2
nd row of matrix A with the values –4 5 1 from matrix B, using partitions
and concatenations involving A and B.
(d) Create a 4x4 identity matrix called “identity”.
(e) Create a sequence of approximately 100 values for x, covering the range from 1000 to
100,000 so that the values will be equally spaced on a plot that will use a logarithmic x-
axis.
Problem 2 [25 pts]. Write a Matlab program to plot these two functions of x on a single
graph figure (a “multi-plot”), with a single linear x-axis and linear y-axis. Use the good
plotting style that was stressed in class, including an appropriate legend. Use
x
x
F x x x G x
3
Problem 3 [50 pts]. Write an M-file to enter these 4 matrices and then calculate the
results in the order shown below. Use the most concise Matlab statements to accomplish
each task.
A b C d
(a) x A b
1
(b)
C d
A b
(c) Assign the determinant of A to the variable g.
(d) Create the matrix R as a partition of S, containing the intersection of rows 1, 2, 3, and 5
with columns 3 and 4 of S.
(e)
1
T
(f) V U d Cb
T
( )