MATLAB round
时间: 2023-11-24 22:21:43 浏览: 117
round2even:执行舍入到偶数运算。 此操作比舍入到更大更准确。-matlab开发
The round function in MATLAB rounds the input value to the nearest integer. If the input value is exactly halfway between two integers, it rounds to the nearest even integer.
Syntax:
rounded_value = round(input_value)
Example:
input_value = 3.67;
rounded_value = round(input_value)
% Output: rounded_value = 4
input_value = 5.5;
rounded_value = round(input_value)
% Output: rounded_value = 6
input_value = 6.5;
rounded_value = round(input_value)
% Output: rounded_value = 6
input_value = 7.5;
rounded_value = round(input_value)
% Output: rounded_value = 8
阅读全文