How to simulate low-pass filter in ads 20 14
There are many ways to design filters. The simplest method is to calculate the N-order and cut-off frequency of the most qualified butt worth filter with the existing buttord, and then calculate the coefficient vectors B and A of the numerator and denominator polynomials of the N-order butt worth digital filter system with butt ord. Draw the amplitude-frequency and phase-frequency diagram of the filter with freqz function. Filter with a filter. Example: stipulation: wp is passband cutoff frequency; Ws is the stopband cutoff frequency; Ap is the maximum attenuation of passband (dB); As is the maximum attenuation of stopband (db); Wc is 3dB cutoff frequency; Fn is the sampling rate; Filter design conditions: maximum attenuation of passband ap= 1dB, minimum attenuation of stopband as= 15dB, passband cutoff frequency wp=2000Hz, stopband cutoff frequency ws=5000Hz code: fn =16000; AP = 0. 1; As = 60wp = 2000ws = 5000% Input filter condition WPP = WP/(fn/2); WSS = ws/(fn/2); % normalization; [nwn]= but ord(WPP,wss,ap,as); % calculation order cutoff frequency [ba]=butter(n, wn); % Calculate the coefficient vectors b and a of numerator and denominator polynomials of n-order Butterworth digital filter system. freqz(b,a,5 12,fn); % Make amplitude-frequency and phase-frequency diagrams with h (z) t = (1:1000)/16000; x = cos(4000 * pi * t)+cos(6000 * pi * t); % input signal diagram (2); Subplots (2, 1,1); plot(t,x); Time domain waveform axis ([00.01-22]) x = FFT (x); % Fourier transform subgraph (2, 1, 2); plot(ABS(X)); Y = filter (b, a, x); % coefficients of filter B and filter A, and X pre-filtering sequence diagram (3); Subplots (2, 1,1); %plot(t,y); % separates the time domain waveform axis of the output signal ([00.01-1.51.5]); Subplots (2, 1, 2); plot(t,cos(4000 * pi * t)); %cos(4000*pi*t) theoretical time domain waveform axis ([00.01-1.51.5])