And I'll show you why at the end of the video. I'm not going to suppress the outputs in this example. So now that we found the pattern, the question is, how do we create this matrix in a loop? Well, the first step is going to be to create the initial vector. And the second column reads 3, 4, 5, 6, 7, et cetera, et cetera. See, this first column reads 1, 2, 3, 4, 5. The values in each row are equal to 1 plus the values above it. If we look closely at this matrix, we can see a pattern. And I want to make the following matrix from it, this one right here. We're going to do this by answering a few questions. Today, we're going to talk about creating a matrix in a loop. MATLAB supports (and encourages) vectorized operations on vectors and matrices.įor example, suppose we have A and B, two n-by- m matrices and we want C to be the element-wise product of the corresponding elements (i.e., C(i,j) = A(i,j)*B(i,j)).Hello, and welcome back to another MATLAB video. implicit array expansion (opens new window).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |