# Sigma Delta Modulator in Mathematica

Below code is for 1st order sigma delta modulator used in ADC/DAC circuits.

z[0] = 0; u[0] = 0; y[0] = 0;
x[n_Integer] := 0.01 n;
y[n_Integer] := If[u[n] \[GreaterSlantEqual] 1, 1, 0];
q[n_Integer] := u[n] - y[n]; u[n_Integer] := u[n - 1] + z[n];
z[n_Integer] := x[n] - y[n - 1];


Now you shall obtain results e.g. y[10], z[15] based on above code. But actually when n is larger than 21, the code keeps running. You cannot get the result instantly.

I tried to use RSolve but failed. I suspect it is because of the quantization function y[n]. "RSolve::deqx: Supplied equations are not difference equations of the given functions."

RSolve[{q[n] == u[n] - y[n], u[n] == u[n - 1] + z[n], z[n] == x[n] - y[n - 1], y[n] == If[u[n\[GreaterSlantEqual] 1, 1, 0], x[n] == 0.01 n, z[0] == u[0] == y[0] == 0}, {u, y, z, q}, n]


The DifferenceRoot seems not working as well.

Actually this is a piece of cake in Excel. But to decribe it in a mathematically proper way in MMA becomes difficult.

z[0] = 0; u[0] = 0; y[0] = 0;

• @metroidman Just check e.g. workflowguide/SymbolsAndFunctions in document. (Online version is here: reference.wolfram.com/language/workflowguide/…) Commented Dec 1, 2023 at 0:08