The Linspace,meshgrid,concatenate function in Python

Source: Internet
Author: User

Linspace can be used to implement sampling at the same interval.

numpy.linspace(start, stop, num=50, endpoint=true, retstep=false , dtype=none)

The return value is Numpy.ndarray.

Attach an example:

Np.linspace (1,10,10) Array ([  1.,   2.,   3.,   4.,   5.,   6.,   7.,   8.,   9.,  10.])

Because endpoint=true by default, the resulting number is in the form of this

$x _{k} = x_{min} + \frac{x_{max}-x_{min}}{num-1} * (k-1) $,${k}\in{[1,m]}$

It can be understood that this is a straight line, to be divided into the average num, so it is necessary to num-1 sub-division, the size of each partition is $\frac{x_{max}-x_{min}}{num-1}/$

Meshgrid function is used to, how to say, is used to carry out a joint combination, a two-dimensional plane example.

x = [[+]

y = [+]

After the Meshgrid will produce 6 points of coordinates, the screen of their own brain repair, Lai to draw.

The last function is concatenate, this function can be able to federate a number of matrices together, by default, according to Axia=0 is a column of the way to be combined, according to the need can be specified as Axis=1, or otherwise, it is very convenient to use, but, The matrix or array to be federated must be passed in the form of tuples.

That's it.

The Linspace,meshgrid,concatenate function in Python

Related Article

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.