How to round numbers to specific near point?

2 visualizaciones (últimos 30 días)
Triveni
Triveni el 22 de Jun. de 2022
Respondida: Stephen23 el 22 de Jun. de 2022
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.

Respuesta aceptada

Stephen23
Stephen23 el 22 de Jun. de 2022
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

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by