Bit stream (Delta Sigma ADC) to Decimation filter concerns

조회 수: 30 (최근 30일)
Dali Lai
Dali Lai 2024년 6월 12일
편집: Sudarsanan A K 2024년 6월 13일
Hi, I have a second order delta sigma modulator that I want to process the output bitstream to get the analog output
Right now I have the output bitstream (varying from 0~3.3) exported from Cadence Virtuoso
And I passed the bitstream directly to a decimation filter made using filterDesigner setting the decimation factor the same as my OSR (32)
(input analog sine wave, output bitstream after delta sigma modulator, decimated sine wave on Matlab, FFT of the previous decimated plot)
However, the sine wave looks pretty distorted, I am guessing that's due to the export sampling frequency (the simulation is sampled at much higher rate than my clock frequency) that Cadence Virtuoso does, but I am not certain.
The question is, is there any pre-filter process I need to do in order to decimate a digital data? I couldn't find any example that process the bitstream directly to the decimation filter.
subplot(4,1,3);
xoutfilter = OUT{:,1};
youtfilter = Hm(OUT{:,2}); %Hm being the system object of FIRDecimator
plot(youtfilter)
xlabel('time');
ylabel('voltage');
Thanks a lot!

채택된 답변

Sudarsanan A K
Sudarsanan A K 2024년 6월 13일
편집: Sudarsanan A K 2024년 6월 13일
Hello Dali,
To properly decimate a digital data stream, it is important to consider the anti-aliasing filter requirements. In your case, since you have a second-order delta sigma modulator, it is likely that the output bitstream contains high-frequency noise that needs to be filtered out before decimation.
To achieve this, you can design and apply a low-pass filter to the bitstream before passing it to the decimation filter. This low-pass filter should have a cutoff frequency that is less than half of the desired output sample rate after decimation. You can use the "fir1" function in MATLAB to design the low-pass filter.
Here is a demonstration:
% Parameters
Fs = 3.2e6; % Sampling frequency (e.g., 3.2 MHz)
t = 0:1/Fs:0.01-1/Fs; % Time vector for 10 ms
f = 1e3; % Frequency of the sine wave (e.g., 1 kHz)
% Simulate a sine wave as an example input
inputSignal = 0.5*sin(2*pi*f*t) + 1.5; % Sine wave offset to match 0~3V range
% Simulate ΔΣ modulator output (simplified)
% Here, I simply add noise to simulate a high-frequency bitstream
% In a real scenario, this would be the output from your ΔΣ modulator
noiseSignal = inputSignal + 0.2*randn(size(inputSignal)); % Adding Gaussian noise
% Create a binary-like bitstream to mimic ΔΣ modulated output
threshold = 1.5; % Threshold for binary conversion
bitstream = noiseSignal > threshold; % Convert to binary (0 or 1)
bitstream = bitstream * 3.3; % Scale to 0~3.3V range
% Design a low-pass filter using fir1
N = 50; % Filter order
Fc = 2000; % Cutoff frequency (Hz)
Wn = Fc/(Fs/2); % Normalized cutoff frequency (0 < Wn < 1)
b = fir1(N, Wn); % FIR filter coefficients
% Filter the noisy signal
filtered_signal = filter(b, 1, noiseSignal); % Filter the noisy signal
% Decimation
decimationFactor = 32; % Decimation factor
decimatedSignal = decimate(filtered_signal, decimationFactor, 'fir');
% Plotting
figure;
% Original Input Signal
subplot(5,1,1);
plot(t, inputSignal);
title('Original Input Signal');
xlabel('Time (s)');
ylabel('Amplitude (V)');
% Noisy Input Signal
subplot(5,1,2);
plot(t, noiseSignal);
title('Noisy Input Signal');
xlabel('Time (s)');
ylabel('Amplitude (V)');
% Simulated ΔΣ Modulator Output Bitstream
subplot(5,1,3);
stairs(t, bitstream); % Use 'stairs' for a more accurate digital signal representation
title('Simulated ΔΣ Modulator Output Bitstream');
xlabel('Time (s)');
ylabel('Amplitude (V)');
% Filtered Noisy Signal
subplot(5,1,4);
plot(t, filtered_signal);
title('Filtered Noisy Signal');
xlabel('Time (s)');
ylabel('Amplitude (V)');
% Decimated Signal
t_decimated = downsample(t, decimationFactor); % Downsample the time vector for plotting
subplot(5,1,5);
plot(t_decimated, decimatedSignal);
title('Decimated Signal');
xlabel('Time (s)');
ylabel('Amplitude (V)');
For more information about the "fir1" function, please refer to the documentation:
I hope this helps!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Filter Analysis에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by