[MATLAB] basic matrix content

Source: Internet
Author: User

Zeros (2, 3) is initialized as a 2*3 matrix.

Eye (3) initializes a 3*3 square matrix with a diagonal element of 1.

Linspace (, 5) generates numbers from 2 to 4, which is an arithmetic difference series. When we add 2 and 4, there will be 5 numbers, and we divide 2 to 4 into 5 parts.

S = S * s indicates that two matrices are multiplied.

S = S. * s indicates that the elements of each matrix are multiplied.

X = x. ^ y indicates that each element of matrix X is Y to the power of each element in Y.

X = 2. ^ [x y]

F1 =

1 1
1 1
1 1
1 1

>

A =

1 2
3 4
5 6
7 8

> 2. ^ [A F1]

Ans =

2 4 2 2
8 16 2 2
32 64 2 2
128 256 2 2

 

Sprtm expm logm is used to calculate the index and logarithm of the entire matrix.

Sptr exp log is used to open all numbers in the matrix.

Fliplr (a) is used to flip the left and right sides of matrix.

Flipud (a) flipped up and down a Matrix

Reshape (A,) converts matrix A to a matrix of 2*6. The number of elements before and after conversion cannot be changed, and data is read from the first column in sequence.

T = 0: 0. 02indicates the part starting from 0 to at least equal to 1, plus 0.02

Logspace (, 11) indicates that there are 11 parts from 0 to 1 of 10.

Eg: Write a trigonometric table

X = [0: 0. 05: PI/4] '[x, sin (x), cos (x), Tan (x)]

Disp ('x sin (x) Cos (x) Tan (x) '); displays the header

Disp ([x sin (x) Cos (x) Tan (x)]); display data

This video tutorial is very basic ~

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.