主要内容

log10

R2026b

Common (base 10) logarithm for fixed-point data

Since R2026b

Description

Y = log10(X) returns the common (base 10) logarithm of each element of the fixed-point input X.

Note

For the common logarithm (base 10) of floating-point numbers, use the log10 function.

example

Examples

collapse all

Create a signed fixed-point number and evaluate the base 10 logarithm.

x = fi(10,1,16,6);
y = log10(x)
y = 

    1.0000

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 43
        FractionLength: 34

Create a fixed-point vector of positive values and evaluate the element-wise base 10 logarithm.

X = fi([1 10 100 1000],1,16,4);
Y = log10(X)
Y = 

         0    1.0000    2.0000    3.0000

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 43
        FractionLength: 34

Input Arguments

collapse all

Fixed-point input array, specified as a scalar, vector, matrix, or multidimensional array. X must be a positive, real-valued fi object with binary-point scaling.

Data Types: fi

Output Arguments

collapse all

Base 10 logarithm values, returned as a scalar, vector, matrix, or multidimensional array. The output Y is a signed fi object with the same dimensions as X. The output word length and fraction length are determined automatically based on the input type to preserve the precision and range of the result.

Data Types: fi

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2026b

See Also

| | | |