Skip to main content

Exercises 1.8 Homework

1.

Suppose that A is a matrix. Describe, in words, the following objects:

  1. A(3, :)
  2. A(:, end-2)
  3. A(1:2, end-1:end)
  4. A(1:2:end, 1)
  5. A(:, end:-1:1)
2.

Write a script to do the following:

x = (first 5 digits of your SUID);
y = (all entries of x except first); 
z = (all entries of x except last);
u = (the sum of vectors y and z);
v = (the scalar product of vectors y and z, also known as the dot product in Calculus);

Then display u and v using disp.

Note that y and z must be computed from the vector x, not entered number-by-number.

3.

Write a script that does the following:

  1. Let A be some 3 by 3 matrix filled with numbers 1,2,…,9
  2. Let x be the product of A and a row vector with all entries equal to 1 (think about the correct order of multiplication).
  3. Let y be the product of A and a column vector with all entries equal to 1.

When uploading your script to Blackboard, leave a comment with answers to the following questions:

  1. What is the meaning of the entries of x? In other words, what information about A do we get from the entries of x?
  2. What is the meaning of the entries of y?
Hint
Both x and y represent certain sums.