⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program_11_8.m

📁 数字信号处理和小波分析的源码
💻 M
字号:
% Program 11_8
% Sigma-Delta D/A Converter Operation
%
clf;
colordef black;
% Generate the input sinusoidal sequence
N = input('Type in length of the input sequence = ');
A = input('Type in amplitude of the input = ');;
w0 = 2*pi*0.02;
n = 1:N;
m = n-1;
x = A*cos(w0*m);
figure(1)
axis([0 N -1 1]);
stem(m,x,'g');
xlabel('Time index'); ylabel('Amplitude');
title ('Input digital signal');
figure(2)
% Generation of quantized output
x = (x)/(A);
y = zeros(1,N+1);
a = zeros(1,N+1);
e = 0;
for k = 2:N+1
   a(k) = x(k-1) - e;
   if a(k) >= 0,
      y(k) = 1;
   else
      y(k) = -1;
   end
   e = y(k) - a(k);
end
yn = y(2:N+1);
axis([0 N -1.2 1.2]);
stem(m, yn,'g'); % Plot the quantized output
xlabel('Time'); ylabel('Amplitude');
title ('Digital output of sigma-delta quantizer');
figure(3)
Y = fft(yn);
H = [1 1 0.5 zeros(1,N-5) 0.5 1];% Lowpass filter
YF = Y.*H; % Filtering in the DFT domain
out = ifft(YF);
plot(m,out,'g',m,zeros(size(m)));
xlabel('Time'); ylabel('Amplitude');
title ('Lowpass filtered analog output');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -