0% found this document useful (0 votes)
5 views19 pages

Creating Arrays in MATLAB

This document discusses how to create and manipulate arrays in MATLAB. It covers how to create one-dimensional vectors using elements, constants, and linear spacing. It also covers how to create two-dimensional matrices and use commands like zero, one, and eye. It explains transpose operators and how to address arrays using indices to refer to specific rows and columns. It also covers using colons to select ranges of elements and built-in functions for handling arrays.

Uploaded by

meidi arisalwadi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views19 pages

Creating Arrays in MATLAB

This document discusses how to create and manipulate arrays in MATLAB. It covers how to create one-dimensional vectors using elements, constants, and linear spacing. It also covers how to create two-dimensional matrices and use commands like zero, one, and eye. It explains transpose operators and how to address arrays using indices to refer to specific rows and columns. It also covers using colons to select ranges of elements and built-in functions for handling arrays.

Uploaded by

meidi arisalwadi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CREATING ARRAY

MLBL2

Creating One-Dimension(Vector)

= 2 + 4 + 5

Vector is created by typing the element inside


square bracket []

example

To make column vector using space


To make row vector using ;

Creating vector with constant


spacing

Example
Vector = 2 4 6 8 10

Fist element 2, spacing


2, last element 10

Creating vector with linear


(equal) spacing

Creating two-dimension array


(Matrik)
5
4
21

35
76
32

43
81
40

Zero, one and eye command


Zero (m x n) = zero all element value
One (m x n) = one all element value
Eye (n)
= diagonal matrik have 1 value

TRANSPOSE OPERATOR
Example(vector)

Example(Matrix)

Array Addressing
Ve(k) is vector with position k (column or row).
Example

Ma(k,p) is matrix with position (k refer to row, p refer to column).


Example:

Manipulation data

Using colon: addressing Arrays


Va(m:n) refers to element m through n of the vector va.
Example:

For Matrix

Example:

Adding element to matrix

Deleted data

Build in functions for handling arrays

You might also like