際際滷

際際滷Share a Scribd company logo
ARRAYS
VECTORS & MATRICES
Introduction
 Matrices and vectors (Linear Algebra) are the basic elements in
MATLAB and also the basic elements in control design theory
- So, it is important you know how to handle vectors and
matrices in MATLAB
 General matrix  may be written,
A=
VECTORS
 The vector is created by typing the elements (numbers) inside
square brackets [ ]
 To separate rows, we use a semicolon ;
 To separate columns, we use a comma , or a space  
Example: Create the following vector in command window
variable_name = [ type vector elements ]
1. A =
Keep in Mind !!
 An array of dimension is called a row vector
 An array of dimension is called a column vector
 A row vector is converted to a column vector using the
transpose operator denoted by apostrophe or a single quote
(')
Creating a vector with constant spacing
x = []
Starting Value Final Value
Increment
Example:
Create a vector with element with increment
of
Creating a vector with linear (equal) spacing
 A vector with n elements that are linearly (equally) spaced in
which the first element is and the last element is can be created
by typing the linspace command (MATLAB determines the
correct spacing)
 First element


Note: When the number of elements is omitted, the default is 100
variable_name = linspace(
ACCESS BLOCKS OF ELEMENTS
- To access blocks of elements, we use MATLAB's colon
notation (:)
Example:
1. v (1:3) : Access the first three elements of v
2. v(3:end) : Access all elements from the third through the last
element (end signifies the last element in the vector)
3. v(:) : Produces a column vector
4. v(1:end) : Produces a row vector
MATRICES
 A matrix is an array of numbers. To type a matrix into MATLAB
you must;
1. begin with a square bracket, [
2. separate elements in a row with spaces or commas (,)
3. use a semicolon (;) to separate rows
4. end the matrix with another square bracket, ]
Cont.. .
Dimension
 To determine the dimensions of a matrix or vector, use the
command size
Continuation
 If it is not possible to type the entire row input on the same
line, use consecutive periods, called an ellipsis  , to
signal continuation, then continue the input on the next line
[m,n] = size(A)
Transposing a matrix
 The transpose operation is denoted by an apostrophe or a single
quote ()
 It flips a matrix about its main diagonal and it turns a row vector
into a column vector
Matrix generators
 MATLAB provides functions that generates elementary matrices
as shown in the table below
eye(m,n) Returns an m-by-n matrix with 1 on the main diagonal
eye(n) Returns an n-by-n square identity matrix
zeros(m,n) Returns an m-by-n matrix of zeros
ones(m,n) Returns an m-by-n matrix of ones
diag(A) Extracts the diagonal of matrix A
rand(m,n) Returns an m-by-n matrix of random numbers
Cont.. .
Note: For a complete list of elementary matrices and
matrix manipulations, type help elmat or doc elmat
triu(A) returns the upper triangular portion of matrix A
tril(A) returns the lower triangular portion of matrix A
ARRAY OPERATIONS
o MATLAB has two different types of arithmetic operations:
 matrix arithmetic operations
 array arithmetic operations
MATRIX ARITHMETIC OPERATIONS
: is valid if A and B are of the same size
: multiplies each element of 留
: is valid if A is square and equals A*A
: is valid if A's number of column equals B's
number of rows
ARRAY ARITHMETIC OPERATIONS
o Array arithmetic operations or array operations for short, are
done element-by-element
o The period character, ., distinguishes the array operations from
the matrix operations
o Matrix and array operations are the same for addition (+) and
subtraction (-), the character pairs (.+) and (.-) are not used
Cont.. .
Example:
Find from
A = B =
MATRIX FUNCTIONS
o MATLAB provides many matrix functions for various
matrix/vector manipulations
SOLVING LINEAR EQUATIONS
o One of the problems encountered most frequently in scientific
computation is the solution of systems of simultaneous linear
equations
o With matrix notation, a system of simultaneous linear equations
is written
Where,
 : is a given square matrix of order n
 : is a given column vector of n components,
 : is an unknown column vector of n components
 =
Example
Consider the following system of linear equations,
The coefficient matrix A is
A = B =
Example
Consider the following system of linear equations,
The coefficient matrix A is
A = B =
Cont.. .
This equation can be solved for x using linear algebra. The result is
There are typically two ways to solve for x in MATLAB
1. The first one is to use the matrix inverse, inv
=
Cont.. .
1. The second one is to use the backslash (  ) operator

More Related Content

Similar to 5_Vectors & Matrices for Engineers .pptx (20)

Commands list
Commands listCommands list
Commands list
PRAVEENKUMAR CHIKOTI
Lecture two
Lecture twoLecture two
Lecture two
Mahmoud Hussein
Matlab Introduction Simulink and Basics ds
Matlab Introduction Simulink and Basics dsMatlab Introduction Simulink and Basics ds
Matlab Introduction Simulink and Basics ds
ragupathi90
1
11
1
Mohamed Yaser
2. Chap 1.pptx
2. Chap 1.pptx2. Chap 1.pptx
2. Chap 1.pptx
HassanShah396906
ArrayBasics.ppt
ArrayBasics.pptArrayBasics.ppt
ArrayBasics.ppt
RaselAzam1
Matrix and Matrices
Matrix and MatricesMatrix and Matrices
Matrix and Matrices
esfriendsg
Digital communication lab lectures
Digital communication lab  lecturesDigital communication lab  lectures
Digital communication lab lectures
marwaeng
Matlab colon notation
Matlab colon notationMatlab colon notation
Matlab colon notation
pramodkumar1804
Brief Introduction to Matlab
Brief  Introduction to MatlabBrief  Introduction to Matlab
Brief Introduction to Matlab
Tariq kanher
1 linear algebra matrices
1 linear algebra matrices1 linear algebra matrices
1 linear algebra matrices
AmanSaeed11
Matrix
MatrixMatrix
Matrix
Umar Farooq
Matlab tut3
Matlab tut3Matlab tut3
Matlab tut3
Vinnu Vinay
Matlab Tutorial for Beginners - I
Matlab Tutorial for Beginners - IMatlab Tutorial for Beginners - I
Matlab Tutorial for Beginners - I
Vijay Kumar Gupta
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Dun Automation Academy
Intro to MATLAB and K-mean algorithm
Intro to MATLAB and K-mean algorithmIntro to MATLAB and K-mean algorithm
Intro to MATLAB and K-mean algorithm
khalid Shah
Matlab for marketing people
Matlab for marketing peopleMatlab for marketing people
Matlab for marketing people
Toshiaki Takeuchi
MATRICES.pptx,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
MATRICES.pptx,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,MATRICES.pptx,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
MATRICES.pptx,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
JayshriHuddar
Basic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptxBasic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptx
PremanandS3
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
Satish Gummadi
Matlab Introduction Simulink and Basics ds
Matlab Introduction Simulink and Basics dsMatlab Introduction Simulink and Basics ds
Matlab Introduction Simulink and Basics ds
ragupathi90
ArrayBasics.ppt
ArrayBasics.pptArrayBasics.ppt
ArrayBasics.ppt
RaselAzam1
Matrix and Matrices
Matrix and MatricesMatrix and Matrices
Matrix and Matrices
esfriendsg
Digital communication lab lectures
Digital communication lab  lecturesDigital communication lab  lectures
Digital communication lab lectures
marwaeng
Matlab colon notation
Matlab colon notationMatlab colon notation
Matlab colon notation
pramodkumar1804
Brief Introduction to Matlab
Brief  Introduction to MatlabBrief  Introduction to Matlab
Brief Introduction to Matlab
Tariq kanher
1 linear algebra matrices
1 linear algebra matrices1 linear algebra matrices
1 linear algebra matrices
AmanSaeed11
Matlab Tutorial for Beginners - I
Matlab Tutorial for Beginners - IMatlab Tutorial for Beginners - I
Matlab Tutorial for Beginners - I
Vijay Kumar Gupta
Intro to MATLAB and K-mean algorithm
Intro to MATLAB and K-mean algorithmIntro to MATLAB and K-mean algorithm
Intro to MATLAB and K-mean algorithm
khalid Shah
Matlab for marketing people
Matlab for marketing peopleMatlab for marketing people
Matlab for marketing people
Toshiaki Takeuchi
MATRICES.pptx,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
MATRICES.pptx,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,MATRICES.pptx,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
MATRICES.pptx,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
JayshriHuddar
Basic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptxBasic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptx
PremanandS3
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
Satish Gummadi

More from SungaleliYuen (17)

9_Symbolic Math in MATLAB for Engineers.pptx
9_Symbolic Math in MATLAB for Engineers.pptx9_Symbolic Math in MATLAB for Engineers.pptx
9_Symbolic Math in MATLAB for Engineers.pptx
SungaleliYuen
8_Polynomials, Curve Fitting & Interpolation.pptx
8_Polynomials, Curve Fitting & Interpolation.pptx8_Polynomials, Curve Fitting & Interpolation.pptx
8_Polynomials, Curve Fitting & Interpolation.pptx
SungaleliYuen
7_Programming in MATLAB For Enginee.pptx
7_Programming in MATLAB For Enginee.pptx7_Programming in MATLAB For Enginee.pptx
7_Programming in MATLAB For Enginee.pptx
SungaleliYuen
3_MATLAB Basics Introduction for Engineers .pptx
3_MATLAB Basics Introduction for Engineers .pptx3_MATLAB Basics Introduction for Engineers .pptx
3_MATLAB Basics Introduction for Engineers .pptx
SungaleliYuen
Lecture_3.pptx
Lecture_3.pptxLecture_3.pptx
Lecture_3.pptx
SungaleliYuen
5_Basics of Electrical Machines.pptx
5_Basics of Electrical Machines.pptx5_Basics of Electrical Machines.pptx
5_Basics of Electrical Machines.pptx
SungaleliYuen
4_Inductance, Energy.pptx
4_Inductance, Energy.pptx4_Inductance, Energy.pptx
4_Inductance, Energy.pptx
SungaleliYuen
2_Electric Current.pptx
2_Electric Current.pptx2_Electric Current.pptx
2_Electric Current.pptx
SungaleliYuen
VENANCE AND MPYA.pptx
VENANCE AND MPYA.pptxVENANCE AND MPYA.pptx
VENANCE AND MPYA.pptx
SungaleliYuen
Angela and claudius.pptx
Angela and claudius.pptxAngela and claudius.pptx
Angela and claudius.pptx
SungaleliYuen
MARIA NDAGO PROJECT.pptx
MARIA NDAGO  PROJECT.pptxMARIA NDAGO  PROJECT.pptx
MARIA NDAGO PROJECT.pptx
SungaleliYuen
emmanuel and catherine project.pptx
emmanuel and catherine project.pptxemmanuel and catherine project.pptx
emmanuel and catherine project.pptx
SungaleliYuen
Lecture 3.pptx
Lecture 3.pptxLecture 3.pptx
Lecture 3.pptx
SungaleliYuen
3_Magnetic Circuits.pptx
3_Magnetic Circuits.pptx3_Magnetic Circuits.pptx
3_Magnetic Circuits.pptx
SungaleliYuen
4_Inductance, Energy.pptx
4_Inductance, Energy.pptx4_Inductance, Energy.pptx
4_Inductance, Energy.pptx
SungaleliYuen
3_Types of DC GEN.pptx
3_Types of DC GEN.pptx3_Types of DC GEN.pptx
3_Types of DC GEN.pptx
SungaleliYuen
4_Generator Characteristics.pptx
4_Generator Characteristics.pptx4_Generator Characteristics.pptx
4_Generator Characteristics.pptx
SungaleliYuen
9_Symbolic Math in MATLAB for Engineers.pptx
9_Symbolic Math in MATLAB for Engineers.pptx9_Symbolic Math in MATLAB for Engineers.pptx
9_Symbolic Math in MATLAB for Engineers.pptx
SungaleliYuen
8_Polynomials, Curve Fitting & Interpolation.pptx
8_Polynomials, Curve Fitting & Interpolation.pptx8_Polynomials, Curve Fitting & Interpolation.pptx
8_Polynomials, Curve Fitting & Interpolation.pptx
SungaleliYuen
7_Programming in MATLAB For Enginee.pptx
7_Programming in MATLAB For Enginee.pptx7_Programming in MATLAB For Enginee.pptx
7_Programming in MATLAB For Enginee.pptx
SungaleliYuen
3_MATLAB Basics Introduction for Engineers .pptx
3_MATLAB Basics Introduction for Engineers .pptx3_MATLAB Basics Introduction for Engineers .pptx
3_MATLAB Basics Introduction for Engineers .pptx
SungaleliYuen
5_Basics of Electrical Machines.pptx
5_Basics of Electrical Machines.pptx5_Basics of Electrical Machines.pptx
5_Basics of Electrical Machines.pptx
SungaleliYuen
4_Inductance, Energy.pptx
4_Inductance, Energy.pptx4_Inductance, Energy.pptx
4_Inductance, Energy.pptx
SungaleliYuen
2_Electric Current.pptx
2_Electric Current.pptx2_Electric Current.pptx
2_Electric Current.pptx
SungaleliYuen
VENANCE AND MPYA.pptx
VENANCE AND MPYA.pptxVENANCE AND MPYA.pptx
VENANCE AND MPYA.pptx
SungaleliYuen
Angela and claudius.pptx
Angela and claudius.pptxAngela and claudius.pptx
Angela and claudius.pptx
SungaleliYuen
MARIA NDAGO PROJECT.pptx
MARIA NDAGO  PROJECT.pptxMARIA NDAGO  PROJECT.pptx
MARIA NDAGO PROJECT.pptx
SungaleliYuen
emmanuel and catherine project.pptx
emmanuel and catherine project.pptxemmanuel and catherine project.pptx
emmanuel and catherine project.pptx
SungaleliYuen
3_Magnetic Circuits.pptx
3_Magnetic Circuits.pptx3_Magnetic Circuits.pptx
3_Magnetic Circuits.pptx
SungaleliYuen
4_Inductance, Energy.pptx
4_Inductance, Energy.pptx4_Inductance, Energy.pptx
4_Inductance, Energy.pptx
SungaleliYuen
3_Types of DC GEN.pptx
3_Types of DC GEN.pptx3_Types of DC GEN.pptx
3_Types of DC GEN.pptx
SungaleliYuen
4_Generator Characteristics.pptx
4_Generator Characteristics.pptx4_Generator Characteristics.pptx
4_Generator Characteristics.pptx
SungaleliYuen

Recently uploaded (20)

Industrial Valves, Instruments Products Profile
Industrial Valves, Instruments Products ProfileIndustrial Valves, Instruments Products Profile
Industrial Valves, Instruments Products Profile
zebcoeng
GM Meeting 070225 TO 130225 for 2024.pptx
GM Meeting 070225 TO 130225 for 2024.pptxGM Meeting 070225 TO 130225 for 2024.pptx
GM Meeting 070225 TO 130225 for 2024.pptx
crdslalcomumbai
decarbonization steel industry rev1.pptx
decarbonization steel industry rev1.pptxdecarbonization steel industry rev1.pptx
decarbonization steel industry rev1.pptx
gonzalezolabarriaped
IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...
IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...
IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...
ssuserd9338b
How to Build a Maze Solving Robot Using Arduino
How to Build a Maze Solving Robot Using ArduinoHow to Build a Maze Solving Robot Using Arduino
How to Build a Maze Solving Robot Using Arduino
CircuitDigest
only history of java.pptx real bihind the name java
only history of java.pptx real bihind the name javaonly history of java.pptx real bihind the name java
only history of java.pptx real bihind the name java
mushtaqsaliq9
Power Point Presentation for Electrical Engineering 3-phase.ppt
Power Point Presentation for Electrical Engineering 3-phase.pptPower Point Presentation for Electrical Engineering 3-phase.ppt
Power Point Presentation for Electrical Engineering 3-phase.ppt
Aniket_1415
Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...
Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...
Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...
slayshadow705
15. Smart Cities Big Data, Civic Hackers, and the Quest for a New Utopia.pdf
15. Smart Cities Big Data, Civic Hackers, and the Quest for a New Utopia.pdf15. Smart Cities Big Data, Civic Hackers, and the Quest for a New Utopia.pdf
15. Smart Cities Big Data, Civic Hackers, and the Quest for a New Utopia.pdf
NgocThang9
Wireless-Charger presentation for seminar .pdf
Wireless-Charger presentation for seminar .pdfWireless-Charger presentation for seminar .pdf
Wireless-Charger presentation for seminar .pdf
AbhinandanMishra30
Soil Properties and Methods of Determination
Soil Properties and  Methods of DeterminationSoil Properties and  Methods of Determination
Soil Properties and Methods of Determination
Rajani Vyawahare
Mathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptx
Mathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptxMathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptx
Mathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptx
ppkmurthy2006
TM-ASP-101-RF_Air Press manual crimping machine.pdf
TM-ASP-101-RF_Air Press manual crimping machine.pdfTM-ASP-101-RF_Air Press manual crimping machine.pdf
TM-ASP-101-RF_Air Press manual crimping machine.pdf
ChungLe60
RAMSES- EDITORIAL SAMPLE FOR DSSPC C.pptx
RAMSES- EDITORIAL SAMPLE FOR DSSPC C.pptxRAMSES- EDITORIAL SAMPLE FOR DSSPC C.pptx
RAMSES- EDITORIAL SAMPLE FOR DSSPC C.pptx
JenTeruel1
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
J. Agricultural Machinery
Name.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Name.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVName.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Name.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
MerijimArsedelPalmad1
Best KNow Hydrogen Fuel Production in the World The cost in USD kwh for H2
Best KNow  Hydrogen Fuel Production in the World The cost in USD kwh for H2Best KNow  Hydrogen Fuel Production in the World The cost in USD kwh for H2
Best KNow Hydrogen Fuel Production in the World The cost in USD kwh for H2
Daniel Donatelli
Air pollution is contamination of the indoor or outdoor environment by any ch...
Air pollution is contamination of the indoor or outdoor environment by any ch...Air pollution is contamination of the indoor or outdoor environment by any ch...
Air pollution is contamination of the indoor or outdoor environment by any ch...
dhanashree78
The Golden Gate Bridge a structural marvel inspired by mother nature.pptx
The Golden Gate Bridge a structural marvel inspired by mother nature.pptxThe Golden Gate Bridge a structural marvel inspired by mother nature.pptx
The Golden Gate Bridge a structural marvel inspired by mother nature.pptx
AkankshaRawat75
Introduction to Safety, Health & Environment
Introduction to Safety, Health  & EnvironmentIntroduction to Safety, Health  & Environment
Introduction to Safety, Health & Environment
ssuserc606c7
Industrial Valves, Instruments Products Profile
Industrial Valves, Instruments Products ProfileIndustrial Valves, Instruments Products Profile
Industrial Valves, Instruments Products Profile
zebcoeng
GM Meeting 070225 TO 130225 for 2024.pptx
GM Meeting 070225 TO 130225 for 2024.pptxGM Meeting 070225 TO 130225 for 2024.pptx
GM Meeting 070225 TO 130225 for 2024.pptx
crdslalcomumbai
decarbonization steel industry rev1.pptx
decarbonization steel industry rev1.pptxdecarbonization steel industry rev1.pptx
decarbonization steel industry rev1.pptx
gonzalezolabarriaped
IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...
IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...
IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...
ssuserd9338b
How to Build a Maze Solving Robot Using Arduino
How to Build a Maze Solving Robot Using ArduinoHow to Build a Maze Solving Robot Using Arduino
How to Build a Maze Solving Robot Using Arduino
CircuitDigest
only history of java.pptx real bihind the name java
only history of java.pptx real bihind the name javaonly history of java.pptx real bihind the name java
only history of java.pptx real bihind the name java
mushtaqsaliq9
Power Point Presentation for Electrical Engineering 3-phase.ppt
Power Point Presentation for Electrical Engineering 3-phase.pptPower Point Presentation for Electrical Engineering 3-phase.ppt
Power Point Presentation for Electrical Engineering 3-phase.ppt
Aniket_1415
Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...
Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...
Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...
slayshadow705
15. Smart Cities Big Data, Civic Hackers, and the Quest for a New Utopia.pdf
15. Smart Cities Big Data, Civic Hackers, and the Quest for a New Utopia.pdf15. Smart Cities Big Data, Civic Hackers, and the Quest for a New Utopia.pdf
15. Smart Cities Big Data, Civic Hackers, and the Quest for a New Utopia.pdf
NgocThang9
Wireless-Charger presentation for seminar .pdf
Wireless-Charger presentation for seminar .pdfWireless-Charger presentation for seminar .pdf
Wireless-Charger presentation for seminar .pdf
AbhinandanMishra30
Soil Properties and Methods of Determination
Soil Properties and  Methods of DeterminationSoil Properties and  Methods of Determination
Soil Properties and Methods of Determination
Rajani Vyawahare
Mathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptx
Mathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptxMathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptx
Mathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptx
ppkmurthy2006
TM-ASP-101-RF_Air Press manual crimping machine.pdf
TM-ASP-101-RF_Air Press manual crimping machine.pdfTM-ASP-101-RF_Air Press manual crimping machine.pdf
TM-ASP-101-RF_Air Press manual crimping machine.pdf
ChungLe60
RAMSES- EDITORIAL SAMPLE FOR DSSPC C.pptx
RAMSES- EDITORIAL SAMPLE FOR DSSPC C.pptxRAMSES- EDITORIAL SAMPLE FOR DSSPC C.pptx
RAMSES- EDITORIAL SAMPLE FOR DSSPC C.pptx
JenTeruel1
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
J. Agricultural Machinery
Name.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Name.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVName.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Name.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
MerijimArsedelPalmad1
Best KNow Hydrogen Fuel Production in the World The cost in USD kwh for H2
Best KNow  Hydrogen Fuel Production in the World The cost in USD kwh for H2Best KNow  Hydrogen Fuel Production in the World The cost in USD kwh for H2
Best KNow Hydrogen Fuel Production in the World The cost in USD kwh for H2
Daniel Donatelli
Air pollution is contamination of the indoor or outdoor environment by any ch...
Air pollution is contamination of the indoor or outdoor environment by any ch...Air pollution is contamination of the indoor or outdoor environment by any ch...
Air pollution is contamination of the indoor or outdoor environment by any ch...
dhanashree78
The Golden Gate Bridge a structural marvel inspired by mother nature.pptx
The Golden Gate Bridge a structural marvel inspired by mother nature.pptxThe Golden Gate Bridge a structural marvel inspired by mother nature.pptx
The Golden Gate Bridge a structural marvel inspired by mother nature.pptx
AkankshaRawat75
Introduction to Safety, Health & Environment
Introduction to Safety, Health  & EnvironmentIntroduction to Safety, Health  & Environment
Introduction to Safety, Health & Environment
ssuserc606c7

5_Vectors & Matrices for Engineers .pptx

  • 2. Introduction Matrices and vectors (Linear Algebra) are the basic elements in MATLAB and also the basic elements in control design theory - So, it is important you know how to handle vectors and matrices in MATLAB General matrix may be written, A=
  • 3. VECTORS The vector is created by typing the elements (numbers) inside square brackets [ ] To separate rows, we use a semicolon ; To separate columns, we use a comma , or a space Example: Create the following vector in command window variable_name = [ type vector elements ] 1. A =
  • 4. Keep in Mind !! An array of dimension is called a row vector An array of dimension is called a column vector A row vector is converted to a column vector using the transpose operator denoted by apostrophe or a single quote (')
  • 5. Creating a vector with constant spacing x = [] Starting Value Final Value Increment Example: Create a vector with element with increment of
  • 6. Creating a vector with linear (equal) spacing A vector with n elements that are linearly (equally) spaced in which the first element is and the last element is can be created by typing the linspace command (MATLAB determines the correct spacing) First element Note: When the number of elements is omitted, the default is 100 variable_name = linspace(
  • 7. ACCESS BLOCKS OF ELEMENTS - To access blocks of elements, we use MATLAB's colon notation (:) Example: 1. v (1:3) : Access the first three elements of v 2. v(3:end) : Access all elements from the third through the last element (end signifies the last element in the vector) 3. v(:) : Produces a column vector 4. v(1:end) : Produces a row vector
  • 8. MATRICES A matrix is an array of numbers. To type a matrix into MATLAB you must; 1. begin with a square bracket, [ 2. separate elements in a row with spaces or commas (,) 3. use a semicolon (;) to separate rows 4. end the matrix with another square bracket, ]
  • 9. Cont.. . Dimension To determine the dimensions of a matrix or vector, use the command size Continuation If it is not possible to type the entire row input on the same line, use consecutive periods, called an ellipsis , to signal continuation, then continue the input on the next line [m,n] = size(A)
  • 10. Transposing a matrix The transpose operation is denoted by an apostrophe or a single quote () It flips a matrix about its main diagonal and it turns a row vector into a column vector
  • 11. Matrix generators MATLAB provides functions that generates elementary matrices as shown in the table below eye(m,n) Returns an m-by-n matrix with 1 on the main diagonal eye(n) Returns an n-by-n square identity matrix zeros(m,n) Returns an m-by-n matrix of zeros ones(m,n) Returns an m-by-n matrix of ones diag(A) Extracts the diagonal of matrix A rand(m,n) Returns an m-by-n matrix of random numbers
  • 12. Cont.. . Note: For a complete list of elementary matrices and matrix manipulations, type help elmat or doc elmat triu(A) returns the upper triangular portion of matrix A tril(A) returns the lower triangular portion of matrix A
  • 13. ARRAY OPERATIONS o MATLAB has two different types of arithmetic operations: matrix arithmetic operations array arithmetic operations
  • 14. MATRIX ARITHMETIC OPERATIONS : is valid if A and B are of the same size : multiplies each element of 留 : is valid if A is square and equals A*A : is valid if A's number of column equals B's number of rows
  • 15. ARRAY ARITHMETIC OPERATIONS o Array arithmetic operations or array operations for short, are done element-by-element o The period character, ., distinguishes the array operations from the matrix operations o Matrix and array operations are the same for addition (+) and subtraction (-), the character pairs (.+) and (.-) are not used
  • 17. MATRIX FUNCTIONS o MATLAB provides many matrix functions for various matrix/vector manipulations
  • 18. SOLVING LINEAR EQUATIONS o One of the problems encountered most frequently in scientific computation is the solution of systems of simultaneous linear equations o With matrix notation, a system of simultaneous linear equations is written Where, : is a given square matrix of order n : is a given column vector of n components, : is an unknown column vector of n components =
  • 19. Example Consider the following system of linear equations, The coefficient matrix A is A = B =
  • 20. Example Consider the following system of linear equations, The coefficient matrix A is A = B =
  • 21. Cont.. . This equation can be solved for x using linear algebra. The result is There are typically two ways to solve for x in MATLAB 1. The first one is to use the matrix inverse, inv =
  • 22. Cont.. . 1. The second one is to use the backslash ( ) operator