Design of MATLAB filter

Source: Internet
Author: User

After finding out the tier of the discard wave and the 3dB cutoff frequency, the corresponding Matlab function can be used to calculate the actual function.
The numerator denominator.
The Butterworth type Discard wave is the largest flat in the Bandpass, with a drop-off type, and its calculation command is:
[B,a] = butter (n,wn)% digital low-pass or gravitropism
[B,a] = butter (n,wn, ' ftype ')% digital high-pass or drag-and-hold situation
[B,a] = butter (n,wn, ' s ')% calculated analog low-pass or gravitropism
[B,a] = butter (n,wn, ' ftype ', ' s ')% calculated analog high-pass or band-drag situation
Among them, for the digital discard wave, the Wn is 3dB to the cutoff frequency. For the analog discard wave, the Wn is not
The rad/s of the angular frequency (single-bit), and the relationship with FN is WN=2*PI*FN. When the cutoff frequency is 2 elements
Vectors, to calculate the band-pass or band-stop discard, or whether the high-pass or low-pass discard wave device is calculated. When Ftype is high,
The high-pass, when Ftype is a stop, is a drag. For a digital discard wave, the return value B,a
The number of molecules and the denominator of the function H (z) is a matrix of relationships. The return value of the analog discard wave b,a is a transmittal
Number H (s) of the numerator and denominator of the polynomial matrix.

The Chebyshev type 1 Discard wave is a bandpass (equiripple), a drag-and-drop type, and its calculation command is:
[B,a] = cheby1 (N,RP,WN)% digital low-pass or gravitropism
[B,a] = cheby1 (n,rp,wn, ' ftype ')% digital high-pass or drag-and-hold situation
[B,a] = cheby1 (n,rp,wn, ' s ')% calculated analog low-pass or gravitropism
[B,a] = cheby1 (n,rp,wn, ' ftype ', ' s ')% calculated analog high-pass or band-drag situation

Example

f_n=8000; % sample Rate
f_p=2100; f_s=2500; r_p=3; r_s=25; % Design Requirements Indicator
ws=f_s/(F_N/2); wp=f_p/(F_N/2); % calculation of the rate of one frequency
[N, Wn]=buttord (wp,ws,r_p,r_s); % calculation tier and cutoff frequency
[B,a]=butter (n, Wn); % calculate h (z)
Figure (1);
FREQZ (b,a, 1000, 8000)% make H (z) of the video phase of the video, FREQZ (b,a, calculation point, sample rate)
Subplot (2,1,1); Axis ([0 4000-30 3])
Figure (2); % the second method of making pictures
f=0:40:4000; % calculate frequency and frequency range
Z=exp (j*2*pi*f./(f_n)); %
H_z=polyval (b,z)./polyval (A,z); Calculates the value of the H (z) of the phase response frequency
Subplot (2,1,1); Plot (F, 20*LOG10 (ABS (H_Z))); % Amplitude Frequency characteristics
Axis ([0 4000-40 1]);
Xlabel (' frequency Hz '); Ylabel (' amplitude DB ');
Subplot (2,1,2); Plot (f, Angle (h_z)); % Phase frequency characteristics
Xlabel (' frequency Hz '); Ylabel (' Phase angle rad ');

Design of MATLAB filter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.