ADC Nonlinearity INL and DNL

Hard MATLAB Calibration Asked at Analog Devices
Solve this problem

Characterise an ADC from a histogram of codes captured under a full-scale ramp, computing differential and integral nonlinearity in LSBs.

Constraints

  • Input is a code histogram.
  • DNL of a code is its bin width divided by the ideal width, minus 1.
  • INL is the running sum of DNL.
  • Discard the first and last codes, which saturate.
  • Report the peak absolute DNL and INL.
  • A perfectly linear ADC gives zero for both.
Starter codeMATLAB
1function [dnl, inl] = adc_linearity(histogram)2% TODO3end