Professional Documents
Culture Documents
Matlab
Matlab
MATLABs setup is hosted by PEC University. So, we can follow the following instructions to install the software on our systems. 1. Open Run shortcut from the start menu
2. Since MATLAB is hosted by the PEC University on the local network, we can install it without using a disc
4. Use the installation key as provided by PEC University. Choose the installation type as typical to proceed through a regular MATLAB installation.
6. When the installation completes, an icon would be created on the desktop. We can run MATLAB from there.
A vector is a single array of values. We can declare a vector using square brackets at the console prompt (>>>) >>> vector1 = [1, 2, 4, 5, 6] This command declares a vector with five elements. 2. Declaring matrices Matrices can declared using a notation very similar to vectors but separating rows using a semicolon (;) >>> matrix1 = [1, 2, 3; 4, 5, 6; 7, 8, 9] The above command declares a 3x3 matrix with elements from 1 to 9. 3. Operations on matrices and vectors 1. Add two vectors using the + operator. This adds corresponding elements of the vectors together. >>> v1 = [1, 2, 3, 4, 5] >>> v2 = [5, 4, 3, 2, 1] >>> v1 + v2 Ans = [6, 6, 6, 6, 6] 2. Various matrix operations are inbuilt into MATLAB as matrix functions. >>> matrix1 = [1, 2, 3; 4, 5, 6; 7, 8, 9] >>> inv(A)
ans =