How to round numbers to specific near point?

1 次查看(过去 30 天)
I have a vector
A =
6.1
6.04
5.98
5.92
5.86
5.8
5.74
5.69
5.63
5.57
5.52
5.46
5.41
i want to round it near 0.05,
A =
6.1
6.05
6
5.9
5.85
.
.
.
Please help me.

采纳的回答

Stephen23
Stephen23 2022-6-22
A = [6.1;6.04;5.98;5.92;5.86;5.8;5.74;5.69;5.63;5.57;5.52;5.46;5.41]
A = 13×1
6.1000 6.0400 5.9800 5.9200 5.8600 5.8000 5.7400 5.6900 5.6300 5.5700
N = 0.05;
B = round(A/N)*N
B = 13×1
6.1000 6.0500 6.0000 5.9000 5.8500 5.8000 5.7500 5.7000 5.6500 5.5500

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by