Description
In this assignment, you will utilize the basic skills you learned in the first week of class; you
will assign values to variables, use some of MATLAB’s basic functions, and perform some
simple arithmetic operations on scalars and matrices. You should also use this assignment
as a way to get comfortable with the help and doc functions. For your final submission, as
always, please suppress all outputs with semicolons. Separate each question into separate
sections. It may be good to get into the habit of beginning your scripts with clc, clear
and close all. Don’t remember what these do? Use help!
1. Create scalar variables with the following values:
• log10(26)
• 5e
j
2π
3
• arctan(√
15) + 34
•
√
3
2 + j
1
2
Give these variables unique and reasonable names. Using these variables (not the
expressions) create a column vector with each variable as an entry.
2. You should have two complex variables from the previous question. Multiply the
two together (using the variables again) and save that as a variable. Compute the
real part, imaginary part, magnitude and angle of the resulting complex number and
create a row vector using those values as entries.
3. Now with the two vectors from the previous questions, create and save as variables
two 4×4 matrices as follows:
• Regular matrix multiplication (make sure the vectors are in the right order! I
want a 4×4 matrix, not a scalar, i.e. an outer product, not an inner product)
• Transpose (regular transpose not conjugate transpose) the column vector and
multiply it elementwise with the row vector. Then use repmat to extend this
row vector to a 4×4 matrix (use help or doc if you don’t remember how to use
repmat).
4. With these two matrices, perform the following operations (save the results as variables):
• Add the first and two times the second
• Elementwise multiply them
• Subtract two from every entry in the first matrix
• Conjugate transpose either one
1
ECE-210B Homework 1 Samuel Maltz
5. Take the angle of the complex number in question 2 and convert it to degrees (check
out rad2deg). It should be an integer. Save the value as n. Then create these two
row vectors:
• A length 2000 vector with equally spaced entries from 1 to n
• A vector with entries starting at one up to n with entries spaced at intervals of
0.3 (the vector may turn out to not include n)
You will be using both linspace and the colon operator here. Make sure to use the
right one for each!