# HELP WITH Integral nonlinearity (INL) and differential nonlinearity (DNL) of data converters

#### saori

Joined Jan 28, 2023
2
Hi, I'm developing an A/D converter in the LTspice program. However, the circuit presented problems and I only have the transfer curve.
I need to perform performance tests, find the INL and DNL error, how to do it in matlab?
Does anyone know how to assemble the function below from the vectors I have for the curve?
s = inldnl(analog,digital,range,type)
s = inldnl(___,Name,Value)

#### MrChips

Joined Oct 2, 2009
28,113
Welcome to AAC!

Is this homework or a school assignment?

#### saori

Joined Jan 28, 2023
2
Welcome to AAC!

Is this homework or a school assignment?
A school assignment

#### Papabravo

Joined Feb 24, 2006
19,833
Hi, I'm developing an A/D converter in the LTspice program. However, the circuit presented problems and I only have the transfer curve.
I need to perform performance tests, find the INL and DNL error, how to do it in matlab?
Does anyone know how to assemble the function below from the vectors I have for the curve?
s = inldnl(analog,digital,range,type)
s = inldnl(___,Name,Value)
View attachment 286289
I would use a PWL source with the steps described in a file. From the LTspice HELP file
V. Voltage Source
Syntax: Vxxx n+ n- PWL(t1 v1 t2 v2 t3 v3...)
Arbitrary Piece-wise linear voltage source.
For times before t1, the voltage is v1. For times between t1 and t2, the voltage varies linearly between v1 and v2. There can be any number of time, voltage points given. For times after the last time, the voltage is the last voltage.
Syntax: Vxxx n+ n- wavefile=<filename> [chan=<nnn>]

Once you get the basic sequence you can use the REPEAT..FOREVER construct. See PWL sources in the following article:

https://ltwiki.org/index.php?title=Undocumented_LTspice

#### ericgibbs

Joined Jan 29, 2010
17,136
hi saori,
I don't use Matlab, perhaps this PDF maybe of help.
E

#### Attachments

• 174.8 KB Views: 2

#### MrChips

Joined Oct 2, 2009
28,113
Hi, I'm developing an A/D converter in the LTspice program. However, the circuit presented problems and I only have the transfer curve.
I need to perform performance tests, find the INL and DNL error, how to do it in matlab?
Does anyone know how to assemble the function below from the vectors I have for the curve?
s = inldnl(analog,digital,range,type)
s = inldnl(___,Name,Value)
View attachment 286289
Your graph shows voltage vs time.
For D/A and A/D converters you want to show how counts relate to voltage.

For DNL, you want to measure the voltage step at every digital count increment and analyze how that deviates from the theoretical value of a DAC. For an A/D you want to do the reverse, i.e. what is range on input voltages that fit into the same bin (number).

For INL, you want to analyze how the voltage deviates from a straight line function across the full range.