Scale SI

Package: kwave.utilities

Scale a number to the nearest SI unit prefix.

Syntax

xScaled = scaleSI(x)
[xScaled, scale] = scaleSI(x)
[xScaled, scale, prefix] = scaleSI(x)
[xScaled, scale, prefix, prefixFullName] = scaleSI(x)

Description

scaleSI scales the input x to use the nearest SI unit prefix while keeping 1000 > x > 1. This function aids in representing large or small numbers in a more readable format by attaching appropriate SI prefixes such as kilo, mega, milli, micro, etc., and scaling the number accordingly.

Examples

% Scale a large number
x = 5000000;
xScaled = scaleSI(x);
disp(xScaled);
% Scale a small number
x = 0.0005;
xScaled = scaleSI(x);
disp(xScaled);

Input Arguments

  • x - (numeric) The number to be scaled. The function will find the most appropriate SI prefix to scale the number, keeping it between 1 and 1000.

Output Arguments

  • xScaled - (string) Scaled input represented as a string, concatenated with the SI prefix.
  • scale - (double) Numeric scale factor used to scale the input.
  • prefix - (char) Single character representing the SI prefix used for scaling.
  • prefixFullName - (string) Full SI name for the prefix used in scaling.

See Also

  • kwave.utilities.formatDuration