>> x=7.123456789;>> n=7;>> delta=0.5;>> r=x*10^n+delta;>> r=fix(r);>> r=r/10^n;>> disp(r)
MATLAB: What does the following MATLAB code do
rounding approximation
Related Question
- How to prevent Matlab from randomly adding trailing zeros to integers
- How to specify , n ,the number of random integers
- How can I convert a decimal to an integer
- How to replace missing values from a double inside a cell array
- Write a function halfway(n) that given an odd integer n as input, returns the integer that’s halfway between 1 and n. >> halfway(9) ans = 5
- How to round UP to 1 decimal value
Best Answer