0 views

Uploaded by Ashish Verma

some more commands

save

You are on page 1of 3

1.Arithmetic operations:

a*b , a/b, a+b, etc

factorial(3) = 6

Matrix Multiplication:

Let matrix a and b

a*b = simple matrix multiplication.

a.*b= element to element multiplication.

a^2 = matrix a*a

a.^2 =matrix a.*a

2. Concatenation of Matrices

Let x and y be two matrices

**a=[x y] column wise concatenation.// value assigned in a of concatenation
**

b=[x;y] row wise concatenation.// value assigned in b of concatenation

Another method

**a = cat(1,x,y) 1=column wise concatenation.// value assigned in a of concatenation
**

b= cat(2,x,y) 2=row wise concatenation.// value assigned in b of concatenation

Note: order of matrix must keep in mind other wise cat will not happen.

3. Extracting element or a small matrix from a given matrix

Let “a” is the main matrix.=> a(row x col)

Note : means all row or all column; if a(:,[3 6]) means all rows and 3 and 6th coulmn.

**A) extracting only 3rd column a(:,[3])
**

B) Extracting 1st and 4th column a(:,[3 4])

C) Extracting 2nd row only a([2],:)

D) Extracting 2nd and 3rd row a([2 3],:)

E) Extracting a small matrix a([2 3] , [2 3 4]) or a(2:3 , 2:4) //2:4 means 2 to4

2.:) = [1 2 3] C) We want to add element only to 4 col => A(:.2:3)=[1 1. Size of matrix or array Let a matrix A of 3 row and 5 column then size(A) = 3 5 // Use it most Length(A)=5 (bigger value) 8.e 5 a(4) = [ ] Deleting 2nd row form a x matrix x(2.3) = 0 B) We want to Add element to only 4 row => A(4. 7. ones and Eye matrices. Zeros.4. diag(a) = column vector of diagonal element.6) // diagonal element one other elements zeros 6. Diagonal operation in a matrices Let a be an matrix.3) // 2x3 order all element 0 matrix b=ones(4.:)=[ ] Deleting 3nd column form a x matrix x(:.3)=[ ] 5. Element Deletion from matrix Let a matrix a[1.5)// 4row and 5 col order all element 1 matrix c=eye(5.:)=[1 2 3:3 4 5] E) We want to change elements from 2 to 3 row and 2 to 3 col => A(2:3.4.6] and we want to delete 4th element l. NOTE: diagonal of any row or column vector (of 4 elements)= diag matrix of 4 x 4 size.2 2] .5. Adding elements to matrix Let a matrix A of 3 x 3 A) we want to change specific element like at 2nd row and 3rd col => A(2. a=zeros(2.4) = [3 4 5] D) We want to add matrix at 4 and 5 row => A(2:3.

upper].2.2.col) => randi([10. Random Function a) rand .3) // 2x 3 matrix between 10 to 100 e) Ransperm(10) => row vector of 1-10 elements .row.4) = 2x 3 rand matrix c) randi(10.any value b/w 0 and 1 b) rand(2.3) = 2 x 3 matrix of 1-10 numbers d) randi([lowe .100].9.

- DifferenciationUploaded byAssasinator Faz
- PathfinderUploaded byshikharshrestha2003
- AHS 2007 AMaths P1Uploaded byMINGHUI86
- homework helper-grade 3 module 1Uploaded byapi-263076852
- 2012 GaussUploaded byKukuh Kurniadi
- homework helper-grade 3 module 1Uploaded byapi-261399250
- BCA MCQUploaded byViswaprem CA
- Uos Bsc Gen Maths b AllUploaded byAatir Hashmi
- WEEK 8 Further Physics Solutions from Konrad HarradineUploaded byDulwich Physics
- LP S123 (158)Uploaded byRensha LiLy
- MATLAB as a CalculatorUploaded byhodit_rnsit
- AICTE Syllabus 2018-19 -Common.pdfUploaded byLion Yt
- Dynamic Analysis of Steel Frames With Flexible ConnectionsUploaded byAntoine Lance
- SAP APO T-CodesUploaded bygsk71911
- Application of Modal Sensitivity for Power System Harmonic Resonance AnalysisUploaded bycc
- C Program Day-5Uploaded byeshamu
- Bca New Syllabus - Tiruvalluvar UniversityUploaded byBabu