পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Saturday, February 4, 2017

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 = [7 8 9 10 11]
MATLAB will execute the above statement and return the following result −
r =

    7    8    9   10   11 

Column Vectors

Column vectors are created by enclosing the set of elements in square brackets, using semicolon to delimit the elements.

c = [7;  8;  9;  10; 11]
MATLAB will execute the above statement and return the following result −
c =
       7       
       8       
       9       
      10       
      11  
 

Referencing the Elements of a Vector

You can reference one or more of the elements of a vector in several ways. The ith component of a vector v is referred as v(i). For example −

v = [ 1; 2; 3; 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 = [ 1; 2; 3; 4; 5; 6]; % creating a column vector of 6 elements
v(:)
MATLAB will execute the above statement and return the following result −
ans =
     1
     2
     3
     4
     5
     6
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.
rv = [1 2 3 4 5 6 7 8 9];
sub_rv = rv(3:7)
MATLAB will execute the above statement and return the following result −
sub_rv =

   3   4   5   6   7

Vector Operations

In this section, let us discuss the following vector operations −

No comments:

Post a Comment