Main Content

calibrateADC

Remove offset and gain errors from ADC output

Since R2023a

Description

y=calibrateADC(digital,nbits,polarity) removes the linearity impairments such as offset errors and gain errors from the ADC output specified as thedigital argument. You must provide the resolution (nbits) and the signedness (polarity) of the ADC if digital does not represent the full capabilities of the ADC.

y=calibrateADC(analog,digital,range) removes the offset and gain errors from the ADC output based on the analog and digital input arguments. analog and digital must contain sufficient number of sample pairs to compute the full capabilities of the ADC.

y=calibrateADC(___,Name=Value) removes the offset and gain errors from the ADC output using one or more name-value pair arguments in addition to the input arguments in the previous syntaxes. Unspecified arguments take default values.

Input Arguments

collapse all

Analog input values to the ADC, specified as a vector.

Data Types: double

Digital output values from the ADC, specified as an integer vector.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fi

Nominal analog dynamic range of the ADC, specified as a 2-element vector.

Data Types: double

Number of bits physical output bits of the ADC, specified as a positive integer scalar. nbits determines the resolution of the ADC.

Data Types: double

ADC output data polarity, specified as either Unipolar or Bipolar.

Data Types: string

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: y=calibrateADC(digital,Round='on') removes the offset and gain errors from the input digital data and rounds it to the nearest integer.

Offset error metrics to calibrate out of the ADC output, specified as a vector.

Data Types: double

Unit of the offset error, specified as LSB (least significant bit), %FS (percentage full scale), or FS (full scale).

Data Types: string

Gain error metrics to calibrate out of the ADC output, specified as a vector.

Data Types: double

Unit of the gain error, specified as LSB (least significant bit), %FS (percentage full scale), or FS (full scale).

Data Types: string

Determine whether to round the output of the calibrateADC function to the next integer.

Data Types: string

Output Arguments

collapse all

Compensated digital output after removing the ADC offset and gain errors. It is similar to the ADC digital output, only stretched or compressed to account for linearity errors.

Version History

Introduced in R2023a