【正文】
的左右翻轉(zhuǎn)conj是求復(fù)數(shù)的共軛h=real(ifft(Hd))。%h(n)=IDFT[H(k)]w=linspace(0,pi,1000)。 %用于產(chǎn)生0,pi之間的1000點行矢量H=freqz(h,[1],w)。 %濾波器的幅頻特性圖figure(1)plot(w/pi,20*log10(abs(H)))。 %參數(shù)分別是歸一化頻率與幅值xlabel(39。歸一化角頻率39。)。ylabel(39。增益/分貝39。)。title(39。濾波器的增益響應(yīng)39。)。axis([0 1 50 ])。figure(2)subplot(211)fs=2000。t=0:1/fs:。 %定義時間范圍和步長s=sin(2*pi*100*t)+sin(2*pi*300*t)+sin(2*pi*700*t)。 %濾波前信號plot(t,s)。 %濾波前的信號圖像xlabel(39。時間/秒39。)。ylabel(39。幅度39。)。title(39。信號濾波前時域圖39。)。subplot(212)Fs=fft(s,512)。 AFs=abs(Fs)。 %將信號變換到頻域及信號頻域圖的幅值f=(0:255)*fs/512。 %頻率采樣plot(f,AFs(1:256))。 %濾波前的信號頻域圖xlabel(39。頻率/赫茲39。)。ylabel(39。幅度39。)。title(39。信號濾波前頻域圖39。)。figure(3)sf=filter(h,1,s)。 %使用filter函數(shù)對信號進(jìn)行濾波subplot(211)plot(t,sf) %濾波后的信號圖像xlabel(39。時間/秒39。)。ylabel(39。幅度39。)。title(39。信號濾波后時域圖39。)。axis([ 2 2])。 %限定圖像坐標(biāo)范圍subplot(212)Fsf=fft(sf,512)。 AFsf=abs(Fsf)。 %濾波后的信號頻域圖及信號頻域圖的幅值f=(0:255)*fs/512。 %頻率采樣plot(f,AFsf(1:256)) %濾波后的信號頻域圖xlabel(39。頻率/赫茲39。)。ylabel(39。幅度39。)。title(39。信號濾波后頻域圖39。)。附錄四:頻率采樣濾波器設(shè)計的高通濾波器n=50。f=[0,1]。a=[0,0,1]。b=fir2(n,f,a)。freqz(b)附錄五:最優(yōu)等波紋線性相位FIR低通濾波器wp=*pi。ws=*pi。deltap=。deltas=。 wm=wswp。M=ceil((10*log10(deltap*deltas)13)/(*wm))。F=[0,wp,ws,pi]/pi。Ad=[1,1,0,0]。K=deltap/deltas。W=[1/K,1]。 [h,err,res]=firpm(M,F,Ad,W)。 [H,W]=freqz(h,1)。L=M/2。n=0:M。a=[h(L+1),2*h(L:1:1)]。 k=[0:1:L]。W1=[0:1:511]39。*pi/512。A=cos(W1*k)*a39。 figure subplot(2,1,1) stem(n,h,39。fill39。,39。MarkerSize39。,2)axis([0,M,])xlabel(39。n 39。)。ylabel(39。h(n)39。)。title(39。沖激響應(yīng)39。)。 subplot(2,1,2)plot(W/pi,A)。 axis([0,1,])xlabel(39。頻率/(w/pi) 39。)。ylabel(39。幅度/H(e^jw)39。)。title(39。幅度響應(yīng)圖39。)。figure plot(W/pi,20*log10(abs(H)))axis([0,1,100,10])xlabel(39。w/pi39。)。ylabel(39。幅度增益/dB)39。)。title(39。對數(shù)幅度響應(yīng)圖39。)。 figureplot(,)axis([0,1,])xlabel(39。頻率/(w/pi) 39。)。ylabel(39。E(w)39。)。title(39。誤差逼近39。)。附錄外文資料原文The simulation and the realization of the digital filterLv Tiejun,Guo Shuangbing,Xiao XianciThe first chapter figures UnitonIn signal processing, the function of a filter is to remove unwanted parts of the signal, such as random noise, or to extract useful parts of the signal, such as the ponents lying within a certain frequency range. There are two main kinds of filter, analog and digital. They are quite different in their physical makeup and in how they work. An analog filter uses analog electronic circuits made up from ponents such as resistors, capacitors and opamps to produce the required filtering effect. Such filter circuits are widely used in such applications as noise reduction, video signal enhancement, graphic equalisers in hifi systems, and many other areas. There are wellestablished standard techniques for designing an analog filter circuit for a given requirement. At all stages, the signal being filtered is an electrical voltage or current which is the direct analogue of the physical quantity (. a sound or video signal or transducer output) involved. A digital filter uses a digital processor to perform numerical calculations on sampled values of the signal. The processor may be a generalpurpose puter such as a PC, or a specialised DSP (Digital Signal Processor) chip. The analog input signal must first be sampled and digitised using an ADC (analog to digital converter). The resulting binary numbers, representing successive sampled values of the input signal, are transferred to the processor, which carries out numerical calculations on them. These calculations typically involve multiplying the input values by constants and adding the products together. If necessary, the results of these calculations, which now represent sampled values of the filtered signal, are output through a DAC (digital to analog converter) to convert the signal back to analog form.Unit refers to the input signals used to filter hardware or software. If the filter input, output signals are separated, they are bound to respond to the impact of the Unit is separated, such as digital filters filter definition. Digital filter function, which was to import sequences X transformation into export operations through a series Y.According to figures filter function 24hour live response characteristics, digital filters can be divided into two, namely, unlimited long live long live the corresponding IIR filter and the limited response to FIR filters. IIR filters have the advantage of the digital filter design can use simulation results, and simulation filter design of a large number of tables may facilitate simple. It is the shortings of the nonlinear phase。 Linear phase if required, will use the entire network phasecorrection. Image processing and transmission of data collection is required with linear phase filters identity. And FIR linear phase digital filter to achieve, but an arbitrary margin characteristics. Impact from the digital filter response of the units can be divided into two broad categories : the impact of the limited response (FIR) filters, and unlimited number of shocks to (IIR) digital filters.FIR filters can be strictly linear phase, but because the system FIR filter function extremity fixed at the original point, it can only use the higher number of bands to achieve their high selectivity for the same filter design indicators FIR filter called band than a few highIIR 510 times, the cost is higher, Signal delay is also larger. But if the same linear phase, IIR filters must be networkwide calibration phase, the same section also increase the number of filters and network plexity. FIR filters can be used to achieve nonDigui way, not in a limited precision of a shock, and into the homes and quantitative factors of uncertainty arising from the impact of errors than IIR filter small number, and FIR filter can be used FFT algorithms, the putational