Starting from:

$29.99

Assignment 1 Creating Scalar Variables

MATLAB Assignment 1
, Section A
This homework is designed to get you used to thinking in terms of matrices and vectors, as this is
how MATLAB stores its data. You will find that complicated operations can be resolved by one to
two lines of code if you use the correct function and store data in the appropriate form. The other
purpose of this homework is to get you comfortable with using the help and doc functions.
As with all the homeworks, please submit it as a .m file, with suppressed output. Remember
that all lectures and homeworks may be found at github.com/guybaryosef/ECE210-materials. This
homework is due by 4:00 PM on January 29th to guybymatlab@gmail.com. Remember to also
bring a hardcopy in to class!
1. Creating Scalar Variables: Create the following variables. Each construction should be done
in one line. Please use the assigned variable names.
(a) a =
5.7π
6.9
(b) b = 239 + e
5 − 2.5 × 1023
(c) c = ln(4.23) × sin−1
(0.7)
(d) z = (3 + 2j) × (4 + 5j)
2. Complex Operations Find the real part, imaginary part, magnitude, phase and complex
conjugate of z calculated in question 1(d), choosing appropriate variable names for each.
3. Vector and Matrix Variables Create the following variables. Make sure to use the assigned
variable names. When doing parts c and d, make sure you know when to use the colon operator :,
and when to use linspace.
(a) Create a row vector where aV ec =

3.14 15 9 26 + 0.1j

, and with it generate two matrices,
A1 using repmat and A2 using concatenation, such that:
A1 = A2 =


3.14 15 9 26 + 0.1j
3.14 15 9 26 + 0.1j
3.14 15 9 26 + 0.1j


(b) Create two versions of the column version of aV ec, using the matrix operation .
0 and transpose
function in MATLAB. Name the variables bV ec1 and bV ec2 respectively.
(c) Create a row Vector cV ec where the numbers range from -5 to 5 in increasing order and with
an interval of 0.1 between consecutive numbers.
1

More products