Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock 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
Apr 2, 2004
12
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
 
Replies continue below

Recommended for you

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