title: MATLAB date: 2023-01-03 09:51:44 background: bg-[#692316] tags: categories:


Getting Started

Introduction

MATLAB is short for matrix laboratory


Matrix and array operations {.row-span-3}

MATLAB allows you to use a single arithmetic operator or function to manipulate all values ​​in a matrix

a + 10

MATLAB will execute the above statement and return the following results:

ans = 3×3
    11    13    15
    12    14    16
    17    18    20

sin(a)

MATLAB will execute the above statement and return the following results:

ans = 3×3
    0.8415    0.1411   -0.9589
    0.9093   -0.7568   -0.2794
    0.6570    0.9894   -0.5440

To transpose a matrix, use single quotes (')

a'

ans = 3×3
     1     2     7
     3     4     8
     5     6    10

Perform standard matrix multiplication using the * operator, which computes the inner product between rows and columns

p = a*inv(a)

p = 3×3
    1.0000         0         0
         0    1.0000         0
         0         0    1.0000

concatenation {.row-span-2}

Concatenation is the process of joining arrays to form larger arrays. In fact, the first array is formed by concatenating its elements. Pairs of square brackets [] are concatenation operators.

A = [a,a]

A = 3×6

     1     3     5     1     3     5
     2     4     6     2     4     6
     7     8    10     7     8    10

Concatenating arrays next to each other using commas is called horizontal concatenation. Each array must have the same number of rows. Likewise, semicolons can be used for vertical concatenation if the arrays have the same number of columns.

A = [a; a]

A = 6×3

     1     3     5
     2     4     6
     7     8    10
     1     3     5
     2     4     6
     7     8    10

Matrices and arrays{.row-span-3}

To create an array with four elements per row, separate elements with commas (,) or spaces

a = [1 2 3 4]

MATLAB will execute the above statement and return the following results:

a = 1×4
     1     2     3     4

Create a matrix with multiple rows

a = [1 3 5; 2 4 6; 7 8 10]

a = 3×3
     1     3     5
     2     4     6
     7     8    10

5×1 column vector of zeros

z = zeros(5,1)

z = 5×1
     0
     0
     0
     0
     0

Complex number

A complex number has a real part and an imaginary part, and the imaginary unit is the square root of -1.

sqrt(-1)

ans = 0.0000 + 1.0000i

To represent the imaginary part of a complex number, use i or j.

c = [3+4i, 4+3j; -i, 10j]

c = 2×2 complex

   3.0000 + 4.0000i   4.0000 + 3.0000i
   0.0000 - 1.0000i   0.0000 +10.0000i

Basic knowledge

Input the command

Objects

Matrices and Arrays {.row-span-5}

Create and combine arrays

create grid

Refactor and rearrange

index

Value type {.row-span-2}

Create numeric variables

Convert between numeric types

query type and value

Value range

Loops and conditional statements

Array of strings

Character array

Character or string array

Char or string -convert input arguments

CHAR or STRING -convert between numeric and string

Character or string -determine type and attributes {.row-span-2}

type of data

text attribute

character or string -find and replace {.row-span-2}

look up

replace

String matching pattern -build pattern

String match pattern -character match pattern

String matching pattern -pattern search rules

String matching pattern -Boundary pattern {.row-span-2}

String matching pattern -custom pattern display

String matching pattern -regular expression

String matching pattern -join and split

String editing {.row-span-2}

String comparison

Basic Arithmetic {.row-span-3}

Addition

Subtraction

Multiplication

Division

Power

Transpose

Array notation

Modular division and rounding

Custom Binary Functions

Relational operations

value comparison

Logical (Boolean) operations

true or false condition

Set operation

union, intersection, set relationship

Bitwise operations

set, offset, or compare specific bitfields

Data import and export

text file -read and write table or timetable {.row-span-2}

Basic import and export

Define import rules

Text files -read and write matrices and arrays

Spreadsheet -Read and Write Table or Timetable {.row-span-2}

Basic import and export

Define import rules

Spreadsheet -Reading and writing matrices and arrays

images

Read or write a NetCDF file {.row-span-2}

NetCDF library package -library functions

NetCDF library package -file operations {.row-span-2}

NetCDF Library Package -Dimensions

NetCDF library package -group

NetCDF library package -variable {.row-span-3}

NetCDF library package -properties

NetCDF library package -user-defined types

:- :-
netcdf.defVlen Define user-defined variable length array type (NC_VLEN)
netcdf.inqUserType Return information about user-defined type
netcdf.inqVlen Return information about user-defined NC_VLEN type {.style-list}

NetCDF library package -Utilities

Read or write HDF5 files

HDF5 library package {.row-span-4}

HDF4 Files -Advanced Functions

Low-level functions -package {.row-span-3}

Low Level Functions -Functions

FITS file -function

FITS files -file access

FITS files -image processing

FITS file -keyword {.row-span-2}

FITS files -Header Data Unit (HDU) access

FITS files -image compression

FITS file -ASCII table and binary table {.row-span-3}

FITS files -Utilities

Stripe interleaved file

Common Data Format (CDF)

Bag

Read video data

Write video data

Read or write audio

Play audio

Record audio

Play sound

Reading and writing XML documents

W3C DOM

XML Transformation

XPath query

JSON format

Workspace variables and MAT-file {.row-span-2}

Low-level file I/O {.row-span-2}

Serial and USB Communication -Connection and Configuration

Serial and USB communication -read and write

Serial and USB communication -control pins and memory

TCP/IP communication -connection and configuration

TCP/IP communication -read and write

Bluetooth communication -connection and configuration

Bluetooth communication -read and write {.row-span-2}

Bluetooth Low Energy Communication {.row-span-2}

Web Services

FTP file operations {.row-span-2}

Internet of Things (IoT) Data