About four rounding functions in MATLAB: Floor, Ceil, Fix, round explanation (RPM)

Source: Internet
Author: User
Tags rounds

Turn from http://blog.sina.com.cn/s/blog_48ebd4fb010009c2.html floor: round to negative infinity B = floor (a) rounds the elements of a to the nearest integers less than or equal to A. Ceil: Rounding toward positive infinity B = Ceil (a) rounds the elements of a to the nearest integers greater than or equal to a. FIX: Rounding in 0 direction B = fix (a) rounds the elements of a toward zero, resulting in an array of integers.   Round: Rounding B = round (A) rounds the elements of X to the nearest integers. example:a= [ -0.9, -2.1, -0.4, 0.3, 0.8, 1.1, 2.7, -1.2+2.9i];

Floor (a) =[-1, -3,-1, 0, 0, 1, 2, -2+2i]

Ceil (a) = [0,-2, 0, 1, 1, 2, 3, -1+3i]

Fix (a) = [0,-2, 0, 0, 0, 1, 2, -1+2i]

Round (a) =[-1,-2, 0, 0, 1, 1, 3, -1+3i]

Note: For complex X, the four fuctions the imaginary and real parts is rounded independently.

About four rounding functions in MATLAB: Floor, Ceil, Fix, round explanation (RPM)

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.