%% Design of Multistage Decimators
% This demo shows how to get progressively more efficient designs for
% decimators given a set of design specifications. We start with a
% single-section polyphase design, and then move to a multistage decimation
% design. We then allow for transition-band aliasing and design a
% multistage Nyquist filter. Finally, we use a CIC filter for the first
% stage of a multistage design to obtain the most efficient implementation.
%
% Author(s): Ricardo A. Losada
% Copyright 2005 The MathWorks, Inc.
%% Design Specifications
% These are the design specifications we will use throughout the demo
Fs = 100e6; % Input sampling frequency 100 MHz
Fc = 3.125e6; % Cutoff frequency 3.125 MHz
Fp = 2.925e6; % Passband-edge frequency 2.925 MHz
Fst = 3.325e6; % Stopband-edge frequency 3.325 MHz
TW = Fst-Fp; % Transition bandwidth 0.4 MHz
Ap = 1; % Passband ripple 1 dB (peak to peak)
Ast = 80; % Minimum attenuation in stopband 80 dB
%% Creation of an Object to Hold the Specifications
% We can generate an object that groups all specifications with the
% following command:
Hfd = fdesign.decimator(M,'lowpass','Fp,Fst,Ap,Ast',...
Fp,Fst,Ap,Ast,Fs);
%% Design of the Decimation Filter
% In order to design the single-stage filter, we use the 'design' command
% and we specify that we want an optimal equiripple design.
Hm_eq = design(Hfd,'equiripple');
info(Hm_eq)
%%
% The resulting filter has 642 coefficients. Since we use a polyphase
% implementation, the cost of implementing this decimator is 43
% multiplications for each input sample.
fvtool(Hm_eq)
%% Spectrum of the Decimated Signal
% Assuming that the original input signal occupies the entire Nyquist
% interval in a uniform manner, the spectrum of the filtered signal
% acquires the shape of the frequency response of the filter. When the
% filtered signal is downsampled, the spectral replicas are positioned
% adjacent to each other without superimposing themselves above the 80 dB
% allowed. This way, no significant aliasing occurs.
[H,f]=freqz(Hm_eq,8192,Fs,'whole');
figure
plot(f-Fs/2,20*log10(abs(fftshift(H))))
hold on,
plot(f-Fs/2+Fs/M,20*log10(abs(fftshift(H))),'r-')
plot(f-Fs/2-Fs/M,20*log10(abs(fftshift(H))),'k-')
grid on
xlabel(' Frequency (Hz)')
ylabel('dB')
axis([-1e7 1e7 -100 5])
title('Spectrum of decimated signal')
legend('Baseband spectrum','First positive replica','First negative replica')
%% Creation of a Simulink Model
% With a simple command, we can generate a Simulink model for the decimator
% we have designed:
block(Hm_eq,'Destination','new')
%% Multistage Design
% We will now see how to increase the computational efficiency by designing
% a multistage filter for the same design specifications.
Hm_multi = design(Hfd,'multistage');
fvtool(Hm_multi)
%%
% The result of this design are two decimation filters connected in series.
% Partitioning the design in multiple stages reduces the computational
% cost. For this design, the cost is 14.6 multiplications for each input
% sample (on average).
%% Visualizing the Multistage Filter in Simulink
% To generate a Simulink model for this new design, we use the same command
% that we have invoked previously:
block(Hm_multi,'Destination','new')
%% Design of Nyquist Filters for Decimation
% Given the design specifications, it is possible to increment the
% decimation factor in such a way that the spectral replicas of the
% filtered signal, after downsampling, superimpose themselves only in the
% transition band of the filter. This way we can increase the efficiency of
% the design, using Nyquist filters, without incurring in aliasing in the
% band of interest. As an example, if we had an audio signal sampled at a
% very high frequency and we'd like to reduce the sampling frequency to
% 44.1 kHz, we could allow superposition of spectral replicas in the
% frequency band between 20 kHz and 22.05 kHz. The aliasing the occurs in
% such band is not important since this band is not part of the audible
% band of the human ear.
M2 = 16; % Increased decimation factor
Band = M2; % The band should be equal to the decimation factor
Hfn = fdesign.decimator(M2,'nyquist',Band,...
'TW,Ast',TW,Ast,Fs);
%%
% Note that the cutoff frequency of these specifications is given by
% Fs/(2*Band) which corresponds to the same cutoff frequency that we
% originally had. In this manner we ensure that the design specifications
% have not changed. We can also see that in this case we are not specifying
% the passband ripple. It is not possible to specify the passband ripple
% with Nyquist designs. However, as we will see, the resulting ripple will
% be much smaller than the ripple required originally (1 dB peak to peak).
%% Multistage Nyquist Design!
% When we invoke the multistage command in this case, each one of the
% stages of the multistage filter will be a Nyquist filter (because Hfn
% specifies that we want to design a decimator using Nyquist filters).
Hn_multi = design(Hfn,'multistage');
fvtool(Hn_multi)
%%
% The result is 4 halfband filters connected in series. Each halfband
% filter is very efficient since (approximately) half of its coefficients
% are equal to zero, so that it is only necessary to use half of the filter
% length. In this example the computational cost of this design is 10.31
% multiplications for each input sample.
%% Spectrum of the Signal Decimated with Nyquist Filters
% Similarly to the previous case, we can visualize the superposition of the
% spectral replicas of the decimated signal, in this case using Nyquist
% filters. As we have said, in this case, the replicas superimpose
% themselves more than in the previous case. However, there is no
% superposition beyond the 80 dB allowed in regions other than the
% transition bands. This shows that the band of interest does not incur in
% significant aliasing.
[H,f]=freqz(Hn_multi,8192,Fs,'whole');
figure
plot(f-Fs/2,20*log10(abs(fftshift(H))))
hold on,
plot(f-Fs/2+Fs/M2,20*log10(abs(fftshift(H))),'r-')
plot(f-Fs/2-Fs/M2,20*log10(abs(fftshift(H))),'k-')
grid on
xlabel(' Frequency (Hz)')
ylabel('dB')
axis([-1e7 1e7 -100 5])
title('Spectrum of the signal decimated with Nyquist filters')
legend('Baseband spectrum','First positive replica','First negative replica')
%% Multistage Design Using CIC Filters
% Finally, in order to obtain an extremely efficient decimator, we will use
% a CIC filter in thefirst stage of a multistage design. First we will
% design a two-stage decimator and we will see that we will obtain an
% efficiency comparable to the design with Nyquist filters. We will then
% move to a three-stage design and this way we will obtain the most
% efficient design of all designs in this demo.
%% Design of the CIC Filter
% The global decimation factor is 16. We choose a decimation factor of 4
% for the CIC filter leaving a factor of 4 for the remaining stages.
M1 = 4;
D = 1; % Differential delay
Hd1 = fdesign.decimator(M1,'cic',D,Fp,Ast,Fs);
Hcic = design(Hd1,'multisection');
%% Design of the Second Stage: Compensation Filter
% The compensation filter must be designed according to the design
% specifications of the CIC filter to compensate. For this reason, we use
% here the number of sections of the CIC filter as well as the differential
% delay as design parameters.
M2 = 4;
Nsecs = Hcic.NumberOfSections;
Hd2 = fdesign.decimator(M2,'ciccomp',D,Nsecs,Fp,Fst,Ap,Ast,Fs/M1);
Hcomp = design(Hd2,'equiripple');
Hcas = cascade(Hcic,Hcomp); % series connection of the two filters
%%
% This design requires 10.44 multiplications for each input sample. This
% is not an improvement in comparison to the multistage Nyquist design.
% However, we can improve this further by using three stages instead of
% two.
%% Alternate Design, Second Stage: Compensation Filter
% We decide to design a compensation filter with a decimation factor of
% two.
M3 = 2;
Hd3 = fdesign.decimator(M3,'ciccomp',D,...
Nsecs,Fp,Fs/(M1*M3)-Fp
multiratewebinar_oct2005_english.rar_english_软件无线电
版权申诉
171 浏览量
2022-07-15
15:42:03
上传
评论
收藏 4KB RAR 举报
小波思基
- 粉丝: 72
- 资源: 1万+
最新资源
- 基于yolov8+dlib实现视觉识别的安全驾驶监测系统部署到jetson NX平台源码+模型.zip
- Qt框架+OpenCV+动态爱心+编程教学+520
- 基于opencv+yolov8实现目标追踪及驻留时长统计源码.zip
- 水稻病害基于Yolov8算法优化目标检测识别与AI辅助决策python源码+模型+使用说明.zip
- 海尔618算价表_七海5.20_16.00xlsx(1)(2).xlsx
- WebCrawler.scr
- 【计算机专业毕业设计】大学生就业信息管理系统设计源码.zip
- YOLO 数据集:8种路面缺陷病害检测【包含划分好的数据集、类别class文件、数据可视化脚本】
- JAVA实现Modbus RTU或Modbus TCPIP案例.zip
- 基于YOLOv8的FPS TPS AI自动锁定源码+使用步骤说明.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈