Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

MATLAB Tutorial: Understanding Vectors, Referencing Elements, and Vector Operations, Cheat Sheet of Mathematics

Numerical AnalysisLinear AlgebraMATLAB ProgrammingEngineering Mathematics

A comprehensive tutorial on matlab vectors, including how to create row and column vectors, reference vector elements, and perform vector operations such as addition, subtraction, scalar multiplication, transpose, appending, and magnitude. It also covers vector dot product and vectors with uniformly spaced elements.

What you will learn

  • How do you create row vectors in MATLAB?
  • What are the different vector operations supported in MATLAB?
  • How do you reference elements of a column vector in MATLAB?

Typology: Cheat Sheet

2020/2021

Uploaded on 11/04/2021

ahmedsallam
ahmedsallam 🇪🇬

5 documents

1 / 3

Toggle sidebar

Related documents


Partial preview of the text

Download MATLAB Tutorial: Understanding Vectors, Referencing Elements, and Vector Operations and more Cheat Sheet Mathematics in PDF only on Docsity! 10/31/21, 4:21 PM MATLAB - Vectors MATLAB - Vectors A vector is a one-dimensional array of numbers. MATLAB allows creating two types of vectors — . Row vectors ° Column vectors Row Vectors Row vectors are created by enclosing the set of elements in square brackets, using space or comma to delimit the elements. r= [7891011] MATLAB will execute the above statement and return the following result - Column Vectors Column vectors are created by enclosing the set of elements in square brackets, using semicolon to delimit the elements. c= [73 8; 93; 10; 11] MATLAB will execute the above statement and return the following result - Referencing the Elements of a Vector https://www.tutorialspoint.com/matlab/matlab_vectors.htm 413 10/31/21, 4:21 PM MATLAB - Vectors You can reference one or more of the elements of a vector in several ways. The it” component of a vector v is referred as v(i). For example - v=[ 13; 2; 35 4; 5; 6]; % creating a column vector of 6 elements v(3) MATLAB will execute the above statement and return the following result - ans = 3 When you reference a vector with a colon, such as v(:), all the components of the vector are listed. v=[ 13 2; 33 4; 5; 6]; % creating a column vector of 6 elements v(:) MATLAB will execute the above statement and return the following result - ans = AuRWNR MATLAB allows you to select a range of elements from a vector. For example, let us create a row vector rv of 9 elements, then we will reference the elements 3 to 7 by writing rv(3:7) and create a new vector named sub_rv. r= [12345678 9]; sub_rv = rv(3:7) MATLAB will execute the above statement and return the following result - sub_rv = Vector Operations In this section, let us discuss the following vector operations — https://www.tutorialspoint.com/matlab/matlab_vectors.htm 213
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved