Matalab basic learning (1)

Source: Internet
Author: User
Matlab meshgrid Function

Meshgrid is used to generate grids from arrays a and B. The size of the generated grid matrix A and B is the same. It can also be higher-dimensional.

[A, B] = Meshgrid (a, B)
Generate the matrices a and B of size (B) Xsize (. These matrices represent the x and y coordinates of the entire rectangular area.

It is equivalent to adding a from a row to the size (B) Row, turning B into a column and then adding it to the size (a) column again. Therefore, the command is equivalent to: A = ones (size (B) * a; B = B '* ones (size ())

 

As shown in the following figure: matrix A consists of the vector x that copies m rows, and B is composed of the vector y that copies n columns.

> A = []

A =

1 2

> B = [3: 5]

B =

3 4 5

> [A, B] = meshgrid (a, B)

A =

1 2
1 2
1 2

B =

3 3
4
5 5

 

> [B, A] = meshgrid (B,)

B =

3 4 5
3 4 5

A =

1 1 1
2 2 2

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.