-->

How To Make Matlab Data

MATLAB, data is stored in a variable. All variables in MATLAB are arrays. The type of data that becomes elements in an array can be numeric (double) or string / character (char). All elements in the array must match the data type. The shape of the array can be:
  1. The 0 x 0 blank matrix is ​​created using [].
  2. Scalar 1 x 1.
  3. Vector line, which is a matrix measuring 1 x n.
  4. Vector pool, which is a matrix of size x x 1.
  5. Two-dimensional matrix, say m x n or n x n.

As explained that data is stored in a change. Changes / data in MATLAB can be made in several ways. The following are some examples of making data in the form of scalar, vector and matrix in the MATLAB Command Window.

Scalar (string / numeric),


Make row vectors and column vectors,


Make a Matrix


Description: the sign ";" indicates ending the line while p (1,1) = p (line 1, column 1).

The following example is to access some elements of a vector:


The following example is to delete a certain element from a vector:


Two or more row / column vectors can be combined into a metrics provided the vector size is the same, for example:


The following table contains notations for accessing elements of an array.

Notation
Usability
a(i)
Menyatakan elemen (sel) ke-i dari suatu vector baris atau kolom a.
A(:,i)
Mengakses kolom ke-i dari suatu matriks A.
A(I,:)
Mengakses baris ke-i dari suatu matriks A.
A(i,j)
Mengakses baris ke-i kolom ke-j dari suatu matriks A.

Here are some examples of using the notation above:


The size of the matrix can be checked using the command size, for example:


The table below contains several functions that are useful in building an array in MATLAB.

Notation
Usability
zeros(m,n)
Build an array of size (m x n) whose elements are all zero
ones(m,n)
Build an array of size (m x n) whose elements are all 1
rand(m,n)
Build an array of size (m x n) whose elements are random variable data with uniform / uniform distribution (0,1)
randn(m,n)
Build an sized array (m x n) whose elements are standard normal distribution random data variables
eye(n)
Build an identity matrix measuring (n x n)
eye(m,n)
Build an array of size (m x n) whose ‘diagonal main elements’ are worth one
diag(x)
Making diagonal matrix with diagonal elements is mainly vector elements
diag(M)
Used to extract the main diagonal element from the matrix M

The following examples are related to the functions in the table above:


0 Response to "How To Make Matlab Data"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel