Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding Values 1

Status
Not open for further replies.

kollurulp

Mechanical
Joined
Apr 2, 2004
Messages
12
Location
DE
Hi

I need to roung the values in a matrix for example i have a vector A = [0.151 0.155 1.12 1.17 2.25 2.31] and tolerance is 0.05. then i should get the result as
B = [0.155 0.155 1.17 1.17 2.25 2.31]. So i must be able to round the values to the max or min which falls in the range of 0.05. please let me know if there is some function or there is any other way round to get this.

Thanks in advance
Prasanna
 
I need to roung the values in a matrix for example i have a vector A = [0.151 0.155 1.12 1.17 2.25 2.31] and tolerance is 0.05. then i should get the result as
B = [0.155 0.155 1.17 1.17 2.25 2.31].

Your example is confusing. you say 0.05, but you're rounding to 0.005. In the latter case, 0.151 should round to 0.150, not 0.155. If this is correct, then you should divide all the numbers by 5, round to 3 decimal places and multiply by 5.

TTFN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top