Main Content

calibrateDAC

Compensate DAC input for offset and gain errors

Since R2023a

Description

y=calibrateDAC(digital,nbits,polarity) removes the linearity impairments such as offset errors and gain errors from the DAC input 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=calibrateDAC(digital,analog,range) removes the offset and gain errors from the DAC input based on the digital and analog input arguments. analog and digital must contain sufficient number of sample pairs to compute the full capabilities of the ADC.

y=calibrateDAC(digital,analog,ref,bias) removes the offset and gain errors from the DAC input based on the digital, analog, ref, and bias arguments.

y=calibrateDAC(___,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

Digital input values to the DAC, specified as an integer vector.

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

Analog output values from the DAC, specified as a vector.

Data Types: double

Analog dynamic output range of the DAC, specified as a 2-element vector.

Data Types: double

Constant analog reference of the DAC, specified as a real valued scalar.

Data Types: double

Intended analog bias of the DAC, specified as a real valued scalar.

Data Types: double

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

Data Types: double

DAC input 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=calibrateDAC(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 DAC input, 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 DAC input, 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 calibrateDAC function to the next integer.

Data Types: string

Output Arguments

collapse all

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

Version History

Introduced in R2023a