数字信号处理实验六文档格式.docx
《数字信号处理实验六文档格式.docx》由会员分享,可在线阅读,更多相关《数字信号处理实验六文档格式.docx(11页珍藏版)》请在冰豆网上搜索。
[b3,a3]=cheby2(N,0.5,Wn,'
[N4Wn4]=ellipord(Wp,Ws,0.5,40,'
[b4,a4]=ellip(N,0.5,40,Wn,'
%[b,a]=cheby1(N,Wn,'
wa=0:
(3*Ws)/40000:
3*Ws;
h1=freqs(b1,a1,wa);
h2=freqs(b2,a2,wa);
h3=freqs(b3,a3,wa);
h4=freqs(b4,a4,wa);
subplot(2,2,1)
plot(wa/(2*pi),20*log10(abs(h1)));
grid
xlabel('
Frequency,Hz'
ylabel('
Gain,dB'
title('
buttordGainresponse'
axis([03*Fs-605]);
subplot(2,2,2)
plot(wa/(2*pi),20*log10(abs(h2)));
cheb1ordGainresponse'
subplot(2,2,3)
plot(wa/(2*pi),20*log10(abs(h3)));
cheb2ordGainresponse'
subplot(2,2,4)
plot(wa/(2*pi),20*log10(abs(h4)));
ellipordGainresponse'
disp('
N1的值'
disp(N1)
N2的值'
disp(N2)
N3的值'
disp(N3)
N4的值'
disp(N4)
巴特沃兹:
9阶切比雪夫I,II:
5阶椭圆滤波器:
4阶
Q7-5
clf
Ws=[0.40.6];
Wp=[0.20.8];
Rp=0.4;
Rs=50;
%EstimatetheFilterOrder
[N1,Wn1]=buttord(Wp,Ws,Rp,Rs);
%DesigntheFilter
[num,den]=butter(N1,Wn1,'
stop'
%Displaythetransferfunction
NumeratorCoefficientsare'
disp(num);
DenominatorCoefficientsare'
disp(den);
%Computethegainresponse
[g,w]=gain(num,den);
%Plotthegainresponse
plot(w/pi,g);
grid
axis([01-605]);
\omega/\pi'
ylabel('
GainindB'
GainResponseofaButterworthBandstopFilter'
传输函数的表达式为:
,设计不符合指标,通带边界频率不符合要求。
Q7-6
Ws=[0.4];
Wp=[0.2];
Rp=0.5;
Rs=40;
[N1,Wn1]=cheb1ord(Wp,Ws,Rp,Rs);
[num,den]=cheby1(N1,0.5,Wn1);
,设计符合指标。
Q7-13
N=kaiord(2000,2500,0.005,0.005,10000)
disp(N)
计算所得阶数为46,ceil的作用是返回大于或等于指定表达式的最小整数。
nargin的作用是输入参数个数。
Q7-20
b=fir1(200,0.4)
disp(b)
[g,w]=gain(b,1)
plot(w/pi,g)
Grid
阶数为46时:
当阶数为200时:
符合设计要求。
Q7-25
fpts=[00.250.30.450.51]
mval=[0.40.4110.80.8]
b=fir2(95,fpts,mval)
w=0:
8*pi/511:
2*pi;
h=freqz(b,1,w);
plot(w/pi,abs(h));
%disp(b)
%[g,w]=gain(b,1)
%plot(w/pi,g)
%grid
Q8-1
Wp=[0.40.5];
Ws=[0.10.8];
Rp=1;
Rs=30;
[num,den]=butter(N1,Wn1);
Numeratorcoefficientsare'
Denominatorcoefficientsare'
impres=direct2(num,den,[1zeros(1,4*N1)]);
[p,d]=strucver(impres,2*N1);
Actualnumeratorcoeffsare'
disp(p'
Actualdenominatorcoeffsare'
disp(d'
Numeratorcoefficientsare
0.05710-0.114300.0571
Denominatorcoefficientsare
1.0000-0.50991.2862-0.33500.4479
Actualnumeratorcoeffsare
0.0571-0.0000-0.11430.00000.0571
Actualdenominatorcoeffsare
Q8-2
impres=filter(num,den,[1zeros(1,4*N1)]);
1.0000-0.50991.2862-0.33500.4479
Q8-9
k=0:
50;
w2=0.7*pi;
w1=0.2*pi;
x1=1.5*cos(w1*k);
x2=2*cos(w2*k);
x=x1+x2;
[N,Wn]=ellipord(0.25,0.55,0.5,50);
[num,den]=ellip(N,0.5,50,Wn);
通带边界为0.25,阻带边界为0.55,通带波纹为0.5,最小阻带衰减为50,正弦序列频率分别为0.7
和0.2
。
Q8-10
%y=filter(num,den,x);
%subplot(2,1,1);
%stem(k,x);
grid;
axis([050-44]);
%xlabel('
Timeindexn'
Amplitude'
%title('
InputSequence'
%subplot(2,1,2);
%stem(k,y);
OutputSequence'
输入信号经过滤波器后产生正弦信号,由于滤波器存在输入延迟,所以初始部分不是正规的正弦信号。