# Coursera machine learning week 2 Quiz answer Octave and Matlab Tutorial | Andrew NG￼

In this article, you will find Coursera machine learning week 2 Quiz answer Octave and Matlab Tutorial | Andrew NG￼. Use “Ctrl+F” To Find Any Questions or Answers. For Mobile Users, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Options to Get Any Random Questions Answer.
Try to solve all the assignments by yourself first, but if you get stuck somewhere then feel free to browse the code. Don’t just copy-paste the code for the sake of completion.  Even if you copy the code, make sure you understand the code first.

### Coursera machine learning week 2 Quiz answer Octave and Matlab Tutorial | Andrew NG￼

1. Suppose I first execute the following Octave/Matlab commands:

```A = [1 2; 3 4; 5 6];
B = [1 2 3; 4 5 6];```

Which of the following are then valid commands? Check all that apply. (Hint: A’ denotes the transpose of A.)

•  C = A * B;
•  C = B’ + A;
•  C = A’ * B;
•  C = B + A;

2. Let

Which of the following indexing expressions gives

Check all that apply.

•  B = A(:, 1:2);
•  B = A(1:4, 1:2);
•  B = A(:, 0:2);
•  B = A(0:4, 0:2);

3. Let A be a 10×10 matrix and x be a 10-element vector. Your friend wants to compute the product Ax and writes the following code:

```v = zeros(10, 1);
for i = 1:10
for j = 1:10
v(i) = v(i) + A(i, j) * x(j);
end
end```

How would you vectorize this code to run without any for loops? Check all that apply.

•  v = A * x;
•  v = Ax;
•  v = x’ * A;
•  v = sum (A * x);

4. Say you have two column vectors v and w, each with 7 elements (i.e., they have dimensions 7×1). Consider the following code:

```z = 0;
for i = 1:7
z = z + v(i) * w(i)
end```

Which of the following vectorizations correctly compute z? Check all that apply.

•  z = sum (v .* w);
•  z = w’ * v;
•  z = v * w’;
•  z = w * v’;

5. In Octave/Matlab, many functions work on single numbers, vectors, and matrices. For example, the sin function when applied to a matrix will return a new matrix with the sin of each element. But you have to be careful, as certain functions have different behavior. Suppose you have an 7×7 matrix X. You want to compute the log of every element, the square of every element, add 1 to every element, and divide every element by 4. You will store the results in four matrices, A, B, C, D. One way to do so is the following code:

```for i = 1:7
for j = 1:7
A(i, j) = log(X(i, j));
B(i, j) = X(i, j) ^ 2;
C(i, j) = X(i, j) + 1;
D(i, j) = X(i, j) / 4;
end
end```

Which of the following correctly compute A, B, C or D? Check all that apply.

•  C = X + 1;
•  D = X / 4;
•  A = log (X);
•  B = X ^ 2;

Disclaimer:  Hopefully, this article will be useful for you to find all the Coursera machine learning week 2 Quiz answer Octave and Matlab Tutorial | Andrew NG  and grab some premium knowledge with less effort.
Finally, we are now, in the end, I just want to conclude some important message for you, Feel free to ask doubts in the comment section. I will try my best to answer it. If you find this helpful by any means like, comment, and share the post. Please share our posts on social media platforms and also suggest to your friends to Join Our Groups. Don’t forget to subscribe. This is the simplest way to encourage me to keep doing such work.
Is Andrew Ng’s Machine Learning course good?
It is the Best Course for Supervised Machine Learning! Andrew Ng Sir has been like always has such important & difficult concepts of Supervised ML with such ease and great examples, Just amazing!
How do I get answers to coursera assignment?
Use “Ctrl+F” To Find Any Questions Answered. & For Mobile Users, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Options to Get Any Random Questions Answer.
How long does it take to finish coursera Machine Learning?
this specialization requires approximately 3 months with 75 hours of materials to complete, and I finished it in 3 weeks and spent an additional 1 week reviewing the whole course.
How do you submit assignments on Coursera Machine Learning?
Submit a programming assignment Open the assignment page for the assignment you want to submit. Read the assignment instructions and download any starter files. Finish the coding tasks in your local coding environment. Check the starter files and instructions when you need to. Reference

Sharing Is Caring