MATLAB Data Processing Quick Learning Tutorial

Source: Internet
Author: User
Tags rand

This article is a collection of the basic operation of MATLAB, data storage and calculation, the line and curve of data fitting and drawing, the use of For-if-while statement of the general operation of Matlab is a basic and detailed application examples, is very suitable for beginners to learn the MATLAB fast grasp. The following four modules are described separately:


========================basicoperations========================

>> A=rand (3,2)

A =

0.8147 0.9134

0.9058 0.6324

0.1270 0.0975

>> a=[1 2;3 4;5 6]

A =

1 2

3 4

5 6

>> A (3,2)

Ans =

6

>> A (2,:)

Ans =

3 4

>> A ([1 3],:)%select the 1st and 3rd row

Ans =

1 2

5 6

>> Save Test.mat A

>> Save Testtext.txt A–ascii



>> A (:, 2) =[10,11,12]

A =

1 10

3 11

5 12

>> a=[a,[101;102;103]]%append another column vector

A =

1 10 101

3 11 102

5 12 103

>> A (:)%put all elements of A to a single vector

Ans =

1

3

5

10

11

12

101

102

103

B=[11,12;13,14;15,16]

B =

11 12

13 14

15 16

>> C=[a B]

C =

1 10 101) 11 12

3 11 102) 13 14

5 12 103) 15 16

A=[1 2;3 4;5 6]

A =

1 2

3 4

5 6

>> C=[a; B

C =

1 2

3 4

5 6

11 12

13 14

15 16

========================computingon data========================

>>a.*b% the data in the corresponding position, that is, the element product

Ans =

11 24

39 56

75 96

>>a '% transpose

Ans =

1 3 5

2 4 6

>> a<3

Ans =

1 1

0 0

0 0

>> Find (A<3)

Ans =

1

4

A =

8 1 6

3 5 7

4 9 2

>> [R,c]=find (a>=6)

R =

1

3

1

2

c =

1

2

3

3

A=[1 15 2 0.5]

A =

1.0000 15.0000 2.0000 0.5000

>> sum (a)

Ans =

18.5000

>> prod (a)

Ans =

15

>> floor (a)% removed boundary

Ans =

1 15 2 0

>> ceil (a)% upper bound

Ans =

1 15 2 1

RAND (3)% created

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.