matlab - Rounding to a power of 10 -
i have variable, taumax
, want round up nearest power of ten(1, 10, 100, 1000...). using below expression find closest integer max value in tau array. finding max value because trying calculate power of ten should x axis cutoff. in cause, taumax equal 756, want have expression outputs either 1000, or 3(for 10^3).
taumax = round(max(tau));
i'd appreciate help!
since you're talking base 10, use log10
number of digits.
how about:
>> ceil(log10(756)) ans = 3
Comments
Post a Comment