CTDSM Using Matlab

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 42

Sahand University of Technology

Electrical Engineering Department


Microelectronic Research Center
A Simulation Training for Sigma-Delta
Modulators by Matlab CAD-Tool
By: Mostafa azadbakht
Advisor: Dr.E.Najafi aghdam

These simulations are performed by Matlab CAD-tool.


Its need that the delsig toolbox attached with your CAD-tool before you want to start
simulation .
delsig toolbox is a dataset codes that was written by Shreier in [1].

Two possible way to simulate a DSM in


Matlab CAD-tool

By Simulink
block library

By code
3

Block diagram of a discrete-time(DT) DSM:

Step-by-step simulation codes for a discrete - time DSM by Schreier codes:

Step 1

Define a input and a desired transfer function (NTF)

Step 2

Used of the simulation commands of Schreier codes to run and simulate the DSM

Step 3

Taking the Fast Fourier Transform (FFT) of the output signal and calculating the SNR
5

Step-by-step code simulations for a discrete - time DSM by Schreier codes:

STEP1:
Define a desired NTF as:
NTF = synthesizeNTF(order,osr,opt)
STEP 2:
Generating the feed-back paths gain as follow:
FB = realizeNTF(NTF,CIFB)
STEP 3:
Generating the feed-forward paths gain as follow:
FF = realizeNTF(NTF,CIFF)
6

Low pass DT-DSM, order 1:


Gain paths (FB1=1)

Low pass DT-DSM, order 1:


close all,clear all,clc
osr=64;
N=1;
Nlev=2^N;
n=2^13;
z=57;
t=[0:n-1];
H=synthesizeNTF(1,osr,1);
u=0.5*(Nlev-1)*sin(2*pi*z/n*t);
v=simulateDSM(u,H,Nlev);
spec=fft(v)/(n*(Nlev-1)/2);
snr=calculateSNR(spec(1:ceil(n/(2*osr))+1),z);
clear f
f=linspace(0,0.5,n/3);
figure,plot(f,dbv(spec(1:n/3)),'b'),grid on

Used of the plotsp to plot the spectrum as: plotsp(vo,vi,k);k=1.5~4

Low pass DT-DSM, order 2:


Gain paths (FB1=1 FB2=1)

10

Low pass DT-DSM, order 2:

close all,clear all,clc


osr=64;
N=1;
Nlev=2^N;
n=2^13;
z=57;
t=[0:n-1];
H=synthesizeNTF(2,osr,1);
u=0.5*(Nlev-1)*sin(2*pi*z/n*t);
v=simulateDSM(u,H,Nlev);
spec=fft(v)/(n*(Nlev-1)/2);
snr=calculateSNR(spec(1:ceil(n/(2*osr))+1),z);
clear f
f=linspace(0,0.5,n/3);
figure,plot(f,dbv(spec(1:n/3)),'b')
11

Used of the plotsp to plot the spectrum as: plotsp(vo,vi,k);k=1.5~4

12

Low pass DT-DSM, order 3:


Gain paths (FB1=0.44 FB2=0.2881 FB3=0.7997)

13

Low pass DT-DSM, order 3:

close all,clear all,clc


osr=64;
N=1;
Nlev=2^N;
n=2^13;
z=57;
t=[0:n-1];
H=synthesizeNTF(3,osr,1);
u=0.5*(Nlev-1)*sin(2*pi*z/n*t);
v=simulateDSM(u,H,Nlev);
spec=fft(v)/(n*(Nlev-1)/2);
snr=calculateSNR(spec(1:ceil(n/(2*osr))+1),z);
clear f
f=linspace(0,0.5,n/3);
figure,plot(f,dbv(spec(1:n/3)),'b')
14

Used of the plotsp to plot the spectrum as: plotsp(vo,vi,k);k=1.5~4

15

Low pass DT-DSM, order 4:


Gain paths (FB1=0.2923 FB2=1.4212 FB3=2.7446 FB4=2.5536 // FF1=2.5536 FF2=2.7446 FF3=1.4212
FF4=0.2923)

16

Low pass DT-DSM, order 4:

close all,clear all,clc


osr=64;
N=1;
Nlev=2^N;
n=2^13;
z=57;
t=[0:n-1];
H=synthesizeNTF(4,osr,1);
u=0.5*(Nlev-1)*sin(2*pi*z/n*t);
v=simulateDSM(u,H,Nlev);
spec=fft(v)/(n*(Nlev-1)/2);
snr=calculateSNR(spec(1:ceil(n/(2*osr))+1),z);
clear f
f=linspace(0,0.5,n/3);
figure,plot(f,dbv(spec(1:n/3)),'b')
17

Used of the plotsp to plot the spectrum as: plotsp(vo,vi,k);k=1.5~4

18

Low pass to band pass conversion mechanism is as follow

19

Band pass DT-DSM, order 1:

20

Band pass DT-DSM, order 1:


close all;clear all;clc
amp=0.452;
n=2^15;
t=[0:n];
fin=0.24589746;
u=amp*sin(2*pi*fin*t);
y=zeros(1,n);
v=y;
for i=3:n;
y(i)=-y(i-2)-u(i-2)+v(i-2);
if y(i)>0
v(i)=1;
else
v(i)=-1;
end
end
figure(100),plotsp(u,v,2);figure(200),plot(v)
21

Used of the plotsp to plot the spectrum as: plotsp(vo,vi,k);k=1.5~4

22

Band pass DT-DSM, order 2:

23

Band pass DT-DSM, order 2:


close all;clear all;clc
amp=0.452;
n=2^15;
t=[0:n];
fin=0.24985;
u=amp*sin(2*pi*fin*t);
y=zeros(1,n);
v=y;
for i=5:n;
y(i)=-2*y(i-2)-y(i-4)-2*u(i-2)-u(i-4)+2*v(i-2)+v(i-4);
if y(i)>0
v(i)=1;
else
v(i)=-1;
end
end
figure(100),plotsp(u,v,2);figure(200),plot(v)
24

Used of the plotsp to plot the spectrum as: plotsp(vo,vi,k);k=1.5~4

25

Band pass DT-DSM, order 3:

26

Band pass DT-DSM, order 3:


close all;clear all;clc
amp=0.452;
n=2^15;t=[0:n];fin=0.24898789;
u=amp*sin(2*pi*fin*t);
y=zeros(1,n);
v=y;
for i=7:n;
y(i)=-3*y(i-2)-3*y(i-4)-y(i-6)-0.8*u(i-2)-1.32*u(i-4)0.56*u(i-6)+0.8*v(i-2)+1.32*v(i-4)+0.56*v(i-6);
if y(i)>0
v(i)=1;
else
v(i)=-1;
end
end
figure(100),plotsp(u,v,2);figure(200),plot(v)
27

Used of the plotsp to plot the spectrum as: plotsp(vo,vi,k);k=1.5~4

28

Band pass DT-DSM, order 4:

29

Band pass DT-DSM, order 4:

close all;clear all;clc


amp=0.452;
n=2^15;t=[0:n];fin=0.24898789;
u=amp*sin(2*pi*fin*t);
y=zeros(1,n);
v=y;
for i=7:n;
y(i)=-3*y(i-2)-3*y(i-4)-y(i-6)-0.8*u(i-2)-1.32*u(i-4)0.56*u(i-6)+0.8*v(i-2)+1.32*v(i-4)+0.56*v(i-6);
if y(i)>0
v(i)=1;
else
v(i)=-1;
end
end
figure(100),plotsp(u,v,2);figure(200),plot(v)
30

Used of the plotsp to plot the spectrum as: plotsp(vo,vi,k);k=1.5~4

31

Block diagram of a continues-time (CT) DSM:

32

Low pass CT-DSM, order 1:

33

Used of the plotsp to plot the spectrum as: plotsp(vo,vi,k);k=1.5~4

34

Low pass CT-DSM, order 2:


Gain paths (FB1=1 FB2=1.5)

35

Used of the plotsp to plot the spectrum as: plotsp(vo,vi,k);k=1.5~4

36

Low pass CT-DSM, order 3:


Gain paths (FB1=0.2316 FB2=0.7868 FB3=2.4154 // Fg=1/650)

37

Used of the plotsp to plot the spectrum as: plotsp(vo,vi,k);k=1.5~4

38

Low pass CT-DSM, order 4:


Gain paths (FB1=0.0889 FB2=0.1379 FB3=.2039 FB4=0.3184 // Fg=0.0168)

39

Used of the plotsp to plot the spectrum as: plotsp(vo,vi,k);k=1.5~4

40

Bibliography

1-Undrestanding Delta-Sigma Data Converter ,Richard Schreier & Gabor C.Temes ,WILEY Publication.

2-Delta-Sigma Modulators Modeling, Design and Applications ,George I bourdopouls , Imperial college Press
Publication.

41

If you have any questions feel free to


contact me.
Email: M.Azadbakht.1371@gmail.com
M_Azadbakht@sut.ac.ir

42

You might also like