2013F002/Q6s

From CDS 130

Jump to: navigation, search

Quiz 6 - CDS 130, Fall 2013.

(Sample Quiz; no use of MATLAB is allowed.)

Name: ____________________ Section (circle one) 9am or 10:30am

You have 10 minutes to finish the quiz. When you are done, turn over your quiz; the instructor will collect the quizzes.

Converting a series of commands to a nested for loop

Re-write the following commands using a nested for loop.

k = 1
  j = 1
  M(k,j) = j+k;
  j = 2;
  M(k,j) = j+k;
  j = 3;
  M(k,j) = j+k;
k = 2
  j = 1
  M(k,j) = j+k;
  j = 2;
  M(k,j) = j+k;
  j = 3;
  M(k,j) = j+k;
k = 3
  j = 1
  M(k,j) = j+k;
  j = 2;
  M(k,j) = j+k;
  j = 3;
  M(k,j) = j+k;
M
Personal tools