This document provides instructions for initializing and accessing elements in matrices and vectors in MATLAB. It explains how to initialize a matrix of zeros, use a for loop without a semicolon, and access elements of a matrix using parentheses with row and column indices. It also demonstrates how to initialize a matrix and vector using square brackets with elements separated by semicolons or spaces.
This document provides instructions for initializing and accessing elements in matrices and vectors in MATLAB. It explains how to initialize a matrix of zeros, use a for loop without a semicolon, and access elements of a matrix using parentheses with row and column indices. It also demonstrates how to initialize a matrix and vector using square brackets with elements separated by semicolons or spaces.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online from Scribd
This document provides instructions for initializing and accessing elements in matrices and vectors in MATLAB. It explains how to initialize a matrix of zeros, use a for loop without a semicolon, and access elements of a matrix using parentheses with row and column indices. It also demonstrates how to initialize a matrix and vector using square brackets with elements separated by semicolons or spaces.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online from Scribd
1. Initialization of a matrix a = zeros(n); 2. No semi colon after a loop statement For i=1:j Statement End 3.
Now in order to access any element of a matrix a(I,j). 4. Similar case is with any vector 5. To initialize the matrix use square brackets a=[ 1 2 3; 4 5 6; 7 8 9] 6. Similar is the case for vectors. 7.