MATLAB - FDAtool Toolbox filter design (1)

FDAtool MATLAB Toolbox Toolbox is designed to produce in the filter, powerful, easy to operate. We only need to enter the filter parameters, the filter can be generated corresponding to the program and the corresponding parameter of the filter matrix. This article describes briefly FDAtool toolbox, and filter design to meet the requirements manner generating program.

A: FDAtool Open Toolbox interface

1. Open the way
we only need to enter fdatool in the command line window and run to open the toolbox FDAtool
2. interface display
Here Insert Picture Description(1) the bottom we can select the relevant parameter generation filter. Whether it is a low-pass or band-pass; FIR filter or IIR filter, we can select and parameter generation basis. It can be said is very powerful.
(2) lower left seven modules are further designed based on the filter, where we can generate converted to the corresponding filter simulink model used. Of course, function Not only that, but the editor is limited capacity, remains to be further study.
(3) middle of the two blocks, on the left illustrates the filter information, you can save a generated through filter model, used for the next opened again FDAtool this toolbox. Box on the right shows the various images designed filter, the specific content to be displayed above the function of the control bar
(4) of each field image display function described
Here Insert Picture Description
in FIG., The eight module to generate various properties of the filter common image module. Its corresponding function we will devote to illustrate.

II: image analysis filters

In a (4) we mentioned eight modules commonly used now be explained.
Each image generated by the filter parameters as follows:
Here Insert Picture Description
eight modules left to right are:
(. 1) amplitude-frequency response of the Magnitude Response--
result parameters as described in FIG.
(2) Phase Response-- phase frequency response analysis
Here Insert Picture Description
(3) Magnitude And phase Responses-- a total frequency response
Here Insert Picture Description
(4) group delay Response-- group delay analysis
Here Insert Picture Description
(5) phase Delay-- phase delay
Here Insert Picture Description
(6) impulse Response-- impulse response analysis
Here Insert Picture Description
(7) Step Response-- analysis of step response
Here Insert Picture Description
(8) pole / zero Plot-- pole-zero plot analysis
Here Insert Picture Description

Three: FDAtool design program derived filters

1. The filter parameters are generated based on two filters (the filter parameter input click Design)
2. After generating the click file-Generate MATLAB code-Filter Design Function. Generating a corresponding stored program and
3. generation procedure is as follows:

function Hd = FDAtool_test_BUTTER
%FDATOOL_TEST_BUTTER Returns a discrete-time filter object.

% MATLAB Code
% Generated by MATLAB(R) 9.6 and Signal Processing Toolbox 8.2.
% Generated on: 10-Mar-2020 16:08:01

% Butterworth Lowpass filter designed using FDESIGN.LOWPASS.

% All frequency values are in Hz.
Fs = 100001;  % Sampling Frequency

Fpass = 200;         % Passband Frequency
Fstop = 350;         % Stopband Frequency
Apass = 1;           % Passband Ripple (dB)
Astop = 80;          % Stopband Attenuation (dB)
match = 'stopband';  % Band to match exactly

% Construct an FDESIGN object and call its BUTTER method.
h  = fdesign.lowpass(Fpass, Fstop, Apass, Astop, Fs);
Hd = design(h, 'butter', 'MatchExactly', match);

% [EOF]

4. We will this program into the main function, using Fliter (filter parameters, the original signal) is filtered.
In this simulation program as:
Hd = FDAtool_test_BUTTER;
D = filter (Hd, S);
original image signal is:
Here Insert Picture Description
filtered image is:
Here Insert Picture Description
you can see, we have designed a filter is working properly, successful simulation
of course, in the resulting change filter function parameters directly, the filter may be changed its scope. For example, we will change Fpass 500, Fstop to 600. Generated simulation images:
Here Insert Picture Description
We can see that the filter can also work
so that, in the case of a substantially constant, the resulting filter can be used repeatedly, very convenient

Four: simulation test code

%%%%%%%%%%%%%%%%%%%%%%%FDAtool工具箱使用%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all;clc;
%%%%%%%%%%%%%%%%%%%%%%%原始信号
fs=100e3;                                %高采样率还原真实频域
t=0:1/fs:1;
w1=2*pi*100;
w2=2*pi*400;
w3=2*pi*700;
s=cos(w1*t)+0.8*cos(w2*t)+0.6*cos(w3*t); %混合信号构建
s_f=fft(s)/length(t);                    %幅度还原
s_ff=fftshift(s_f);                                 
f_f=(-length(t)/2:length(t)/2-1);        %横坐标对称化,镜像消除
figure;
plot(f_f,abs(s_ff));
xlim([-800,800]);                        %图像清晰化
%%%%%%%%%%%%%%%%%%%%FDAtool程序导出式滤波器设计
Hd = FDAtool_test_BUTTER;
d=filter(Hd,s);
d_f=fft(d)/length(t);
d_ff=fftshift(d_f); 
figure;
plot(f_f,abs(d_ff));
xlim([-800,800]); 
%%%%%%%%%%%%%%%%%%%%导出程序
function Hd = FDAtool_test_BUTTER
%FDATOOL_TEST_BUTTER Returns a discrete-time filter object.

% MATLAB Code
% Generated by MATLAB(R) 9.6 and Signal Processing Toolbox 8.2.
% Generated on: 10-Mar-2020 16:08:01

% Butterworth Lowpass filter designed using FDESIGN.LOWPASS.

% All frequency values are in Hz.
Fs = 100001;  % Sampling Frequency

Fpass = 500;         % Passband Frequency
Fstop = 600;         % Stopband Frequency
Apass = 1;           % Passband Ripple (dB)
Astop = 80;          % Stopband Attenuation (dB)
match = 'stopband';  % Band to match exactly

% Construct an FDESIGN object and call its BUTTER method.
h  = fdesign.lowpass(Fpass, Fstop, Apass, Astop, Fs);
Hd = design(h, 'butter', 'MatchExactly', match);
end

Five: At the end of write

Article only mode generating filter function has been described. In fact, there are many ways to export data filters can even filter designed to directly convert into other languages ​​such as VHDL. FDAtool is a very powerful toolkit, but limited capacity, yet in-depth study. If new understanding and subsequent functional development, will replenish.

Released three original articles · won praise 4 · Views 234

Guess you like

Origin blog.csdn.net/qq_45001172/article/details/104780857