SlideShare a Scribd company logo
1 of 32
®
Essential Knowledge
• for survival and growth in the present competitive and technological driven economy, It is
widely recognized that essential knowledgeable skills are
o Reading
o Writing
o Problem solving
**These are the basic communication, organization, and technical–logical-- mathematical skills required in the modern
workplace and for further growth these you get primarily school
• However, The marketable skills in addition to the preceding essentials are
o Information processing
o Management and administration
** These are majorly personal build ups and of cause you pay heavily t get certificate for them but level of competency is
based o performance records
• It is widely recognized and accepted by educators, labor experts, economists, and
educational leaders that in the coming decades, the biggest employment gains will be in
occupations that rely on
o Unique or specialized skills
o Intelligence
o Imagination
o Creativity
** These depends on your ability to spot what your environment needs and capitalize on it
Adopted from : Practical MATLAB® Basics for Engineers
Outline
> Creating Array
> Mathematical Operations With Array
> Examples and Problems
1.0 Creating Array (Vectors)
- An array is a list of numbers arranged in rows and/or columns. The simplest array (one-dimensional)
is a row or a column of numbers. A more complex array (two dimensional) is a collection of numbers
arranged in rows and columns
- A one-dimensional array is a list of numbers arranged in a row or a column, Any list of numbers can be
set up as a vector.
- Row vector: To create a row vector type the elements with a space or a comma between the elements
inside the square brackets.
- Column vector: To create a column vector type the left square bracket [ and then enter the elements with
a semicolon between them, or press the Enter key after each element.
- In MATLAB, a vector is created by assigning the elements of the vector to a variable This can be done in
several ways depending on the source of the information that is used for the elements of the vector
- Vectors can be created froma knownlist of numbers, by typing the elements (numbers) inside square
brackets [ ] i.e
- Creating vectors with constant spacingby specifyingthe firstterm,the spacing,and the last termi.e.;
- Creating Vectors with linear(equal) spacingby specifyingthe firstand lastterms,and the numberof
termsi.e.
1.0 Creating Array (Two Dimensional Array)
- Two dimensional array ( also called a matrix) , has numbers in rows and columns
- A matrix is created by assigning the elements of the matrix to a variable. This is done by typing the
elements, row by row, inside square brackets [ ]
- First type the left bracket [ then type the first row, separating the elements with spaces or commas.
To type the next row type a semicolon or press Enter. Type the right bracket ] at the end of the last
row. i.e.
- The elements that are entered can be numbers or mathematical expressions that may include
numbers, predefined variables, and functions. Alltherowsmusthavethesamenumberof elements.
If an element is zero, it has to be entered as such
-
1.0 Creating Array (Special Operations)
- The transpose operator, when applied to a vector, switches a row (column) vector to a column
(row) vector. When applied to a matrix, it switches the rows (columns) to columns (rows). The
transpose operator is applied by typing a single quote ’ i.e.
- The zeros(m,n),ones(m,n), and eye(n)commands can be used to create matrices that have
elements with special values
- The zeros(m,n) and the ones(m,n) commands create a matrix with m rows and n columns in which all
elements are the numbers 0 and 1, respectively
- The eye(n) creates a square matrix with n rows and n columns in which the diagonal elements are equal
to 1 and the rest of the elements are 0. This matrix is called the identity matrix.
1.0 Creating Array (Array Addressing)
- Elements in an array (either vector or matrix) can be addressed individually or in subgroups . This is useful
when there is a need to redefine only some of the elements, when specific elements are to be used in
calculations, or when a subgroup of the elements is used to define a new variable.
- The address of an element in a vector is its position in the row (or column) For a vector named ve, ve(k)refers
to the element in position k. i.e
- The address of an element in a matrix is its position, defined by the row number and the column number
where it is located. For a matrix assigned to a variable ma, ma(k,p) refers to the element in row k and column
p. i.e
1.0 Creating Array (Array Addressing)
- For a vector A colon can be used to address a range of elements in a vector or a matrix.
- va(:) Refers to all the elements of the vector va (either a row or a column vector).
- va(m:n) Refers to elements m through n of the vector va.
- For a matrix.
- A(:,n) Refers to the elements in all the rows of column n of the matrix A.
- A(n,:) Refers to the elements in all the columns of row n of the matrix A.
- A(:,m:n) Refers to the elements in all the rows between columns m and n of the matrix A.
- A(m:n,:) Refers to the elements in all the columns between rows m and n of the matrix A.
- A(m:n,p:q) Refers to the elements in rows m through n and columns p through q of the matrix A.
1.0 Creating Array (Array Addressing)
- A variable that exists as a vector, or a matrix, can be changed by adding elements to it (remember that a
scalar is a vector with one element). A vector (a matrix with a single row or column)
- Elements can be added to an existing vector by assigning values to the new elements. For example, if a vector
has 4 elements, the vector can be made longer by assigning values to elements 5, 6, and so on
- Rows and/or columns can be added to an existing matrix by assigning values to the new rows or columns.
This can be done by assigning new values, or by appending existing variables.
- If a matrix has a size of , and a new value is assigned to an element with an address beyond the size of the
matrix, MATLAB increases the size of the matrix to include the new element. Zeros are assigned to the other
elements that are added
- An element, or a range of elements, of an existing variable can be deleted by reassigning nothing to these
elements. This is done by using square brackets with nothing typed in between them
Row
Column
1.0 Creating Array (Built-in Function)
More Examples
More Examples
1.0 Creating Array (Array Addressing)
- A variable that exists as a vector, or a matrix, can be changed by adding elements to it (remember that a
scalar is a vector with one element). A vector (a matrix with a single row or column)
- Elements can be added to an existing vector by assigning values to the new elements. For example, if a vector
has 4 elements, the vector can be made longer by assigning values to elements 5, 6, and so on
- Rows and/or columns can be added to an existing matrix by assigning values to the new rows or columns.
This can be done by assigning new values, or by appending existing variables.
- If a matrix has a size of , and a new value is assigned to an element with an address beyond the size of the
matrix, MATLAB increases the size of the matrix to include the new element. Zeros are assigned to the other
elements that are added
- An element, or a range of elements, of an existing variable can be deleted by reassigning nothing to these
elements. This is done by using square brackets with nothing typed in between them
2.0 Mathematical Operations With Array
• Mathematical Operations on array are majorly on two forms; The one that follows the rule of linear algebra
and the element by element operations.
• The basic operators are the represented by the following symbols multiplication(*) , addition (+) ,
subtraction(-), division(/) and power (^)
• The operators are used directly for the case of linear algebra and for the element by element multiplication a
period is typed in front of the operators ( .*, ./, and .^ are used the addition and multiplication remaining the
same).
• The operations + (addition) and – (subtraction) can beused to add (subtract) arrays of identical size (the
same numbers of rows and columns) and to add (subtract) a scalar to an array. When two arrays are involved
the sum, or the difference, of the arrays is obtained by adding, or subtracting, their corresponding elements
• When a scalar (number) is added to (or subtracted from) an array, the scalar is added to (or subtracted
from) all the elements of the array.
•
2.0 Mathematical Operations With Array
• Array Multiplication
 The multiplication operation * is executed by MATLAB according to the rules of linear algebra. This means
that if A and B are two matrices, the operation A* B can be carried out only if the number of columns in
matrix A is equal to the number of rows in matrix B. The result is a matrix that has the same number of rows
as A and the same number of columns as B.
 Two vectors can be multiplied only if they have the same number ofelements, and one is a row vector and the
other is a column vector . The multiplication of a row vector by a column vector gives a matrix, which is a
scalar (1 x 1 Matrix).
 When an array is multiplied by a number (actually a number is a array), element in the array is multiplied
by the number.
 The product of the multiplication of two square matrices (they must be ofthe same size) is a square matrix of
the same size. However, the multiplication of matrices is not commutative. This means that if A and Bare both
n x n , then A*B ≠B*A
 For more understanding a review of Matrix Operations is advised .
2.0 Mathematical Operations With Array
• ArrayDivision
• The division operation is also associated with the rules of linear algebra. The division operation can be
explained with the help of the identity matrix and the inverse operation.
• The identity matrix is a square matrix in which the diagonal elements are 1s, and the rest of the elements are
0s
• When the identity matrix multiplies another matrix (or vector), that matrix (or vector) is unchanged (the
multiplication has to be done according to the rules of linear algebra). Thisis equivalent to multiplying a
scalar by 1
• The matrix B is the inverse of the matrix A if, when the two matrices are multiplied, the product is the identity
matrix. Both matrices must be square and the multiplication order can be BA or AB
• Obviously B is the inverse of A, and A is the inverse of B. In MATLAB the inverse of a matrix can be obtained
either by raising A to the power of –1, , or with the inv (A) function
2.0 Mathematical Operations With Array
• ArrayDivision
• MATLAB has two types of array division, right division (/) and left division ().
• Left division is used to solve the matrix equation
• So the solution of the above equation is In MATLAB the last equation can be written by using the
left division character:
• The right division solves the equation In MATLAB the last equation can be written using the
right division character
• The three methods (right, left and inv function) would be used to solve the equation
Brief Sample
2.0 Mathematical Operations With Array
• Element-by-element operations
• These operations are carried out on each ofthe elements of the array (or arrays).
• Element-by-element operations can be done only with arrays of the same size.
• Element-by-element multiplication, division, or exponentiation of two vectors or matrices is entered in
MATLAB by typing a period in front of the arithmetic operator.
• Element-by-element calculations are very useful for calculating the value of a function at many values of its
argument
• for the function y = x2 + 4x ,. Element-by-element operation is needed when x is squared. Each element in
the vector y is the value of y that is obtained when the value of the corresponding element of the vector x is
substituted in the equation. This is shown below.
• More Examples are also attached
Examples on EBEO
2.0 Mathematical Operations With Arrays
(Built in Functions)
3.0 Examples and Problems
3.0 Examples and Problems
• Solution
3.0 Examples and Problems
2.
3.
4.
3.0 Examples and Problems
3.0 Examples and Problems
• Trytheseout
3.0 Examples and Problems
• More Handson Question
3.0 Examples and Problems
• More Handson Question
3.0 Examples and Problems
• EasyRight?. . . . . . One StepFurther
• Good Job!!
• Now Lets move to Module three
• ……… On the move

More Related Content

Similar to Mat lab.pptx

Basic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptxBasic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptx
PremanandS3
 
Brief review on matrix Algebra for mathematical economics
Brief review on matrix Algebra for mathematical economicsBrief review on matrix Algebra for mathematical economics
Brief review on matrix Algebra for mathematical economics
felekephiliphos3
 

Similar to Mat lab.pptx (20)

Basic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptxBasic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptx
 
Brief review on matrix Algebra for mathematical economics
Brief review on matrix Algebra for mathematical economicsBrief review on matrix Algebra for mathematical economics
Brief review on matrix Algebra for mathematical economics
 
Linear_Algebra_final.pdf
Linear_Algebra_final.pdfLinear_Algebra_final.pdf
Linear_Algebra_final.pdf
 
Beginners Guide to Non-Negative Matrix Factorization
Beginners Guide to Non-Negative Matrix FactorizationBeginners Guide to Non-Negative Matrix Factorization
Beginners Guide to Non-Negative Matrix Factorization
 
Matrices
MatricesMatrices
Matrices
 
Engineering Numerical Analysis-Introduction.pdf
Engineering Numerical Analysis-Introduction.pdfEngineering Numerical Analysis-Introduction.pdf
Engineering Numerical Analysis-Introduction.pdf
 
Mbd dd
Mbd ddMbd dd
Mbd dd
 
Introduction to Matlab - Basic Functions
Introduction to Matlab - Basic FunctionsIntroduction to Matlab - Basic Functions
Introduction to Matlab - Basic Functions
 
Fundamentals of Machine Learning.pptx
Fundamentals of Machine Learning.pptxFundamentals of Machine Learning.pptx
Fundamentals of Machine Learning.pptx
 
Advanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & ScientistsAdvanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & Scientists
 
introduction-MATRIX-algebramathematics .pptx
introduction-MATRIX-algebramathematics .pptxintroduction-MATRIX-algebramathematics .pptx
introduction-MATRIX-algebramathematics .pptx
 
Commands list
Commands listCommands list
Commands list
 
Array Presentation
Array PresentationArray Presentation
Array Presentation
 
Matrix and its applications by mohammad imran
Matrix and its applications by mohammad imranMatrix and its applications by mohammad imran
Matrix and its applications by mohammad imran
 
Application of matrices in real life
Application of matrices in real lifeApplication of matrices in real life
Application of matrices in real life
 
1640 vector-maths
1640 vector-maths1640 vector-maths
1640 vector-maths
 
Linear algebra for deep learning
Linear algebra for deep learningLinear algebra for deep learning
Linear algebra for deep learning
 
CE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdfCE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdf
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
MATLAB - Arrays and Matrices
MATLAB - Arrays and MatricesMATLAB - Arrays and Matrices
MATLAB - Arrays and Matrices
 

Recently uploaded

RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
amitlee9823
 
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts ServiceVVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
aroranaina404
 
DESIGN THINKING in architecture- Introduction
DESIGN THINKING in architecture- IntroductionDESIGN THINKING in architecture- Introduction
DESIGN THINKING in architecture- Introduction
sivagami49
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
 
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
amitlee9823
 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation deck
tbatkhuu1
 
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
amitlee9823
 
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
instagramfab782445
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
home
 
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
nirzagarg
 

Recently uploaded (20)

RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
 
SD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxSD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptx
 
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts ServiceVVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
 
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdfJordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
 
DESIGN THINKING in architecture- Introduction
DESIGN THINKING in architecture- IntroductionDESIGN THINKING in architecture- Introduction
DESIGN THINKING in architecture- Introduction
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
 
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation deck
 
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
 
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
Abortion pill for sale in Muscat (+918761049707)) Get Cytotec Cash on deliver...
 
Case Study of Hotel Taj Vivanta, Pune
Case Study of Hotel Taj Vivanta, PuneCase Study of Hotel Taj Vivanta, Pune
Case Study of Hotel Taj Vivanta, Pune
 
Hire 💕 8617697112 Meerut Call Girls Service Call Girls Agency
Hire 💕 8617697112 Meerut Call Girls Service Call Girls AgencyHire 💕 8617697112 Meerut Call Girls Service Call Girls Agency
Hire 💕 8617697112 Meerut Call Girls Service Call Girls Agency
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
 
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
 
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ❣️ 7014168258 ❣️ High Cost Unlimited Ha...
 
Q4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationQ4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentation
 
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...
 

Mat lab.pptx

  • 1. ®
  • 2. Essential Knowledge • for survival and growth in the present competitive and technological driven economy, It is widely recognized that essential knowledgeable skills are o Reading o Writing o Problem solving **These are the basic communication, organization, and technical–logical-- mathematical skills required in the modern workplace and for further growth these you get primarily school • However, The marketable skills in addition to the preceding essentials are o Information processing o Management and administration ** These are majorly personal build ups and of cause you pay heavily t get certificate for them but level of competency is based o performance records • It is widely recognized and accepted by educators, labor experts, economists, and educational leaders that in the coming decades, the biggest employment gains will be in occupations that rely on o Unique or specialized skills o Intelligence o Imagination o Creativity ** These depends on your ability to spot what your environment needs and capitalize on it Adopted from : Practical MATLAB® Basics for Engineers
  • 3. Outline > Creating Array > Mathematical Operations With Array > Examples and Problems
  • 4. 1.0 Creating Array (Vectors) - An array is a list of numbers arranged in rows and/or columns. The simplest array (one-dimensional) is a row or a column of numbers. A more complex array (two dimensional) is a collection of numbers arranged in rows and columns - A one-dimensional array is a list of numbers arranged in a row or a column, Any list of numbers can be set up as a vector. - Row vector: To create a row vector type the elements with a space or a comma between the elements inside the square brackets. - Column vector: To create a column vector type the left square bracket [ and then enter the elements with a semicolon between them, or press the Enter key after each element. - In MATLAB, a vector is created by assigning the elements of the vector to a variable This can be done in several ways depending on the source of the information that is used for the elements of the vector - Vectors can be created froma knownlist of numbers, by typing the elements (numbers) inside square brackets [ ] i.e - Creating vectors with constant spacingby specifyingthe firstterm,the spacing,and the last termi.e.; - Creating Vectors with linear(equal) spacingby specifyingthe firstand lastterms,and the numberof termsi.e.
  • 5. 1.0 Creating Array (Two Dimensional Array) - Two dimensional array ( also called a matrix) , has numbers in rows and columns - A matrix is created by assigning the elements of the matrix to a variable. This is done by typing the elements, row by row, inside square brackets [ ] - First type the left bracket [ then type the first row, separating the elements with spaces or commas. To type the next row type a semicolon or press Enter. Type the right bracket ] at the end of the last row. i.e. - The elements that are entered can be numbers or mathematical expressions that may include numbers, predefined variables, and functions. Alltherowsmusthavethesamenumberof elements. If an element is zero, it has to be entered as such -
  • 6. 1.0 Creating Array (Special Operations) - The transpose operator, when applied to a vector, switches a row (column) vector to a column (row) vector. When applied to a matrix, it switches the rows (columns) to columns (rows). The transpose operator is applied by typing a single quote ’ i.e. - The zeros(m,n),ones(m,n), and eye(n)commands can be used to create matrices that have elements with special values - The zeros(m,n) and the ones(m,n) commands create a matrix with m rows and n columns in which all elements are the numbers 0 and 1, respectively - The eye(n) creates a square matrix with n rows and n columns in which the diagonal elements are equal to 1 and the rest of the elements are 0. This matrix is called the identity matrix.
  • 7. 1.0 Creating Array (Array Addressing) - Elements in an array (either vector or matrix) can be addressed individually or in subgroups . This is useful when there is a need to redefine only some of the elements, when specific elements are to be used in calculations, or when a subgroup of the elements is used to define a new variable. - The address of an element in a vector is its position in the row (or column) For a vector named ve, ve(k)refers to the element in position k. i.e - The address of an element in a matrix is its position, defined by the row number and the column number where it is located. For a matrix assigned to a variable ma, ma(k,p) refers to the element in row k and column p. i.e
  • 8. 1.0 Creating Array (Array Addressing) - For a vector A colon can be used to address a range of elements in a vector or a matrix. - va(:) Refers to all the elements of the vector va (either a row or a column vector). - va(m:n) Refers to elements m through n of the vector va. - For a matrix. - A(:,n) Refers to the elements in all the rows of column n of the matrix A. - A(n,:) Refers to the elements in all the columns of row n of the matrix A. - A(:,m:n) Refers to the elements in all the rows between columns m and n of the matrix A. - A(m:n,:) Refers to the elements in all the columns between rows m and n of the matrix A. - A(m:n,p:q) Refers to the elements in rows m through n and columns p through q of the matrix A.
  • 9.
  • 10. 1.0 Creating Array (Array Addressing) - A variable that exists as a vector, or a matrix, can be changed by adding elements to it (remember that a scalar is a vector with one element). A vector (a matrix with a single row or column) - Elements can be added to an existing vector by assigning values to the new elements. For example, if a vector has 4 elements, the vector can be made longer by assigning values to elements 5, 6, and so on - Rows and/or columns can be added to an existing matrix by assigning values to the new rows or columns. This can be done by assigning new values, or by appending existing variables. - If a matrix has a size of , and a new value is assigned to an element with an address beyond the size of the matrix, MATLAB increases the size of the matrix to include the new element. Zeros are assigned to the other elements that are added - An element, or a range of elements, of an existing variable can be deleted by reassigning nothing to these elements. This is done by using square brackets with nothing typed in between them
  • 12. 1.0 Creating Array (Built-in Function)
  • 15. 1.0 Creating Array (Array Addressing) - A variable that exists as a vector, or a matrix, can be changed by adding elements to it (remember that a scalar is a vector with one element). A vector (a matrix with a single row or column) - Elements can be added to an existing vector by assigning values to the new elements. For example, if a vector has 4 elements, the vector can be made longer by assigning values to elements 5, 6, and so on - Rows and/or columns can be added to an existing matrix by assigning values to the new rows or columns. This can be done by assigning new values, or by appending existing variables. - If a matrix has a size of , and a new value is assigned to an element with an address beyond the size of the matrix, MATLAB increases the size of the matrix to include the new element. Zeros are assigned to the other elements that are added - An element, or a range of elements, of an existing variable can be deleted by reassigning nothing to these elements. This is done by using square brackets with nothing typed in between them
  • 16. 2.0 Mathematical Operations With Array • Mathematical Operations on array are majorly on two forms; The one that follows the rule of linear algebra and the element by element operations. • The basic operators are the represented by the following symbols multiplication(*) , addition (+) , subtraction(-), division(/) and power (^) • The operators are used directly for the case of linear algebra and for the element by element multiplication a period is typed in front of the operators ( .*, ./, and .^ are used the addition and multiplication remaining the same). • The operations + (addition) and – (subtraction) can beused to add (subtract) arrays of identical size (the same numbers of rows and columns) and to add (subtract) a scalar to an array. When two arrays are involved the sum, or the difference, of the arrays is obtained by adding, or subtracting, their corresponding elements • When a scalar (number) is added to (or subtracted from) an array, the scalar is added to (or subtracted from) all the elements of the array. •
  • 17. 2.0 Mathematical Operations With Array • Array Multiplication  The multiplication operation * is executed by MATLAB according to the rules of linear algebra. This means that if A and B are two matrices, the operation A* B can be carried out only if the number of columns in matrix A is equal to the number of rows in matrix B. The result is a matrix that has the same number of rows as A and the same number of columns as B.  Two vectors can be multiplied only if they have the same number ofelements, and one is a row vector and the other is a column vector . The multiplication of a row vector by a column vector gives a matrix, which is a scalar (1 x 1 Matrix).  When an array is multiplied by a number (actually a number is a array), element in the array is multiplied by the number.  The product of the multiplication of two square matrices (they must be ofthe same size) is a square matrix of the same size. However, the multiplication of matrices is not commutative. This means that if A and Bare both n x n , then A*B ≠B*A  For more understanding a review of Matrix Operations is advised .
  • 18. 2.0 Mathematical Operations With Array • ArrayDivision • The division operation is also associated with the rules of linear algebra. The division operation can be explained with the help of the identity matrix and the inverse operation. • The identity matrix is a square matrix in which the diagonal elements are 1s, and the rest of the elements are 0s • When the identity matrix multiplies another matrix (or vector), that matrix (or vector) is unchanged (the multiplication has to be done according to the rules of linear algebra). Thisis equivalent to multiplying a scalar by 1 • The matrix B is the inverse of the matrix A if, when the two matrices are multiplied, the product is the identity matrix. Both matrices must be square and the multiplication order can be BA or AB • Obviously B is the inverse of A, and A is the inverse of B. In MATLAB the inverse of a matrix can be obtained either by raising A to the power of –1, , or with the inv (A) function
  • 19. 2.0 Mathematical Operations With Array • ArrayDivision • MATLAB has two types of array division, right division (/) and left division (). • Left division is used to solve the matrix equation • So the solution of the above equation is In MATLAB the last equation can be written by using the left division character: • The right division solves the equation In MATLAB the last equation can be written using the right division character • The three methods (right, left and inv function) would be used to solve the equation
  • 21. 2.0 Mathematical Operations With Array • Element-by-element operations • These operations are carried out on each ofthe elements of the array (or arrays). • Element-by-element operations can be done only with arrays of the same size. • Element-by-element multiplication, division, or exponentiation of two vectors or matrices is entered in MATLAB by typing a period in front of the arithmetic operator. • Element-by-element calculations are very useful for calculating the value of a function at many values of its argument • for the function y = x2 + 4x ,. Element-by-element operation is needed when x is squared. Each element in the vector y is the value of y that is obtained when the value of the corresponding element of the vector x is substituted in the equation. This is shown below. • More Examples are also attached
  • 23. 2.0 Mathematical Operations With Arrays (Built in Functions)
  • 24. 3.0 Examples and Problems
  • 25. 3.0 Examples and Problems • Solution
  • 26. 3.0 Examples and Problems 2. 3. 4.
  • 27. 3.0 Examples and Problems
  • 28. 3.0 Examples and Problems • Trytheseout
  • 29. 3.0 Examples and Problems • More Handson Question
  • 30. 3.0 Examples and Problems • More Handson Question
  • 31. 3.0 Examples and Problems • EasyRight?. . . . . . One StepFurther
  • 32. • Good Job!! • Now Lets move to Module three • ……… On the move