南京邮电学
实 验 报 告
实验名称:离散时间信号系统时频域表示
离散傅立叶变换z变换
数字滤波器频域分析实现
数字滤波器设计
课程名称 数字信号处理A(双语)
班级学号________
姓 名_____________
开课时间 201 201 学年 第 学期
实验:离散时间信号系统时频域表示
实验目务:
熟悉Matlab基命令理解掌握离散时间信号系统时频域表示简单应Matlab环境中求产生序列序列进行基运算简单离散时间系统进行仿真计算线性时变(LTI)系统激响应卷积输出计算观察序列离散时间傅立叶变换(DTFT)幅度谱相位谱
二实验容:
基序列产生运算: Q11~13Q123Q130~133
离散时间系统仿真: Q21~23
LTI系统:Q219Q221Q228
DTFT:Q31Q32Q34
三实验程结果分析:
Q11 运行P1_1产生单位样序列 u[n] 程序显示波形
clfn1020
u[zeros(110) 1 zeros(120)]
stem(nu)
xlabel('时间序号 n')ylabel('振幅')
title('单位样序列')
axis([10 20 0 12])
Q12 clf 命令作 清图形窗口图形
axis命令作 设置坐标轴范围显示方式
title命令作 图形加名字
xlabel命令作 添加x坐标标注
ylabel命令作 添加y坐标标注
Q13 产生延时11样ud[n]程序运行结果:
clf
n1020
ud[zeros(121) 1 zeros(19)]
stem(nud)
xlabel('时间序号 n')ylabel('振幅')
title('单位样序列')
axis([10 20 0 12])
Q123
n050
f008
phasepi2
A25
arg2*pi*f*nphase
xA*cos(arg)
clf
stem(nx)
axis([0 50 3 3])
grid
title('正弦序列')
xlabel('时间序号 n')
ylabel('振幅')
axis
该序列周期125s
Q 130未污染信号s[n]什样形式?加信噪声d[n]什形式?
Q131语句Xs+d产生噪声污染信号?什
Q132信号x1x2x3预先x间关系什
Q133legend命令作什?
Q21
clf
n0100
s1cos(2*pi*005*n)
s2cos(2*pi*047*n)
xs1+s2
Minput('滤波器需长度')
numones(1M)
yfilter(num1x)M
subplot(221)
plot(ns1)
axis([010022])
xlabel('时间序号n')ylabel('振幅')
title('信号#1')
subplot(222)
plot(ns2)
axis([010022])
xlabel('时间序号n')ylabel('振幅')
title('信号#2')
subplot(223)
plot(nx)
axis([010022])
xlabel('时间序号n')ylabel('振幅')
title('输入信号')
subplot(224)
plot(ny)
axis([010022])
xlabel('时间序号n')ylabel('振幅')
title('输出信号')
axis
输入X[n]s[n]分量该离散时间系统抑制
Q22 程序P21 中 LTI system 修改 y[n] 05(x[n]–x[n–1]) 输入x[n] s1[n]+s2[n] 导致输出
输入影响:该系统现高通滤波器通高频率输入分量S2低频分量输入S1
Q23
clf
n0100
s1cos(2*pi*004*n)
s2cos(2*pi*06*n)
xs1+s2
Minput('滤波器需长度')
numones(1M)
yfilter(num1x)M
subplot(221)
plot(ns1)
axis([010022])
xlabel('时间序号n')ylabel('振幅')
title('信号#1')
subplot(222)
plot(ns2)
axis([010022])
xlabel('时间序号n')ylabel('振幅')
title('信号#2')
subplot(223)
plot(nx)
axis([010022])
xlabel('时间序号n')ylabel('振幅')
title('输入信号')
subplot(224)
plot(ny)
axis([010022])
xlabel('时间序号n')ylabel('振幅')
title('输出信号')
axis
Q219 运行 P2_5 生成结果:
Q221生成MATLAB代码
clf
N 40
num [09 045 035 0002]
den [10 071 046 062]
x [1 zeros(1N1)]
y filter(numdenx)
stem(y)
xlabel('Time index n') ylabel('Amplitude')
title('Impulse Response') grid
程序产生40样示
Q228
clf
h[3 2 1 2 1 0 4 0 3]
x[1 2 3 4 3 2 1]
yconv(hx)
n014
subplot(211)
stem(ny)
xlabel('时间序号n')ylabel('振幅')
title('卷积输出')grid
x1[x zeros(18)]
y1filter(h1x1)
subplot(212)
stem(ny1)
xlabel('时间序号n')ylabel('振幅')title('滤波生成输出')
grid
① y[n] y1[n] 差: 差
②x[n]补零 x1[n]作输入产生y1[n]原长度N1N2两序列转化率返回序列长度N1 + N21相反滤器接受输入信号系统规范返回结果相长度作输入信号转化率滤波器直接较结果必供应滤波器输入已零填充长度L(x)+L(h)1
Q31 程序P3_1计算离散时间傅里叶变换原始序列:H(e)
pause 命令作:加参数直接pause话程序暂停直户意键果加参数pause(15)程序暂停15秒
Q32 程序 P3_1 运行结果
DTFT 关周期函数?答:DTFT关周期函数期 2
四图形称性:实部2周期偶称2周期奇称幅度2周期偶称相位2周期奇称性
Q34 修改程序 P3_1 重做Q32程序
clf
w 4*pi8*pi5114*pi
num [1 3 5 7 9 11 13 15 17]
den 1
h freqz(num den w)
subplot(211)
plot(wpireal(h))grid
title('Real part of H(e^{j\omega})')
xlabel('\omega \pi')
ylabel('Amplitude')
subplot(212)
plot(wpiimag(h))grid
title('Imaginary part of H(e^{j\omega})')
xlabel('\omega \pi')
ylabel('Amplitude')
pause
subplot(211)
plot(wpiabs(h))grid
title('Magnitude Spectrum |H(e^{j\omega})|')
xlabel('\omega \pi')
ylabel('Amplitude')
subplot(212)
plot(wpiangle(h))grid
title('Phase Spectrum arg[H(e^{j\omega})]')
xlabel('\omega \pi')
ylabel('Phase in radians')
修改程序运行结果
DTFT 关周期函数?
答:DTFT 关周期函数周期 2
相位谱中跳变原:角度返回arctan值
实验名称:离散傅立叶变换z变换
实验目务:
掌握离散傅立叶变换(DFT)逆变换(IDFT)z变换逆变换计算分析利Matlab语言完成DFTIDFT计算常性质验证DFT实现线性卷积实现z变换零极点分析求理逆z变换
实验容:
DFTIDFT计算: Q323~324
DFT性质: Q326~329Q336Q338Q340
z变换分析:Q346~348
逆z变换:Q350
实验程结果分析:
Q323 编写MATLAB程序计算画出长度NL点离散傅里叶变换X[k]值中L≥N然计算画出L点离散傅里叶变换X[k]长度N离散傅里叶变换长度L运行程序讨结果
clf
N200
L256
nn [0N1]
kk [0L1]
xR [01*(1100) zeros(1N100)] real part
xI [zeros(1N)] x xR + i*xI
XF fft(xL)
subplot(321)grid
plot(nnxR)grid
title('Re\{x[n]\}')
xlabel('Time index n')
ylabel('Amplitude')
subplot(322)
plot(nnxI)grid
title('Im\{x[n]\}')
xlabel('Time index n')
ylabel('Amplitude')
subplot(323)
plot(kkreal(XF))grid
title('Re\{X[k]\}')
xlabel('Frequency index k')
ylabel('Amplitude')
subplot(324)
plot(kkimag(XF))grid
title('Im\{X[k]\}')
xlabel('Frequency index k')
ylabel('Amplitude')
xx ifft(XFL)
subplot(325)
plot(kkreal(xx))grid
title('Real part of IDFT\{X[k]\}')
xlabel('Time index n')
ylabel('Amplitude')
subplot(326)
plot(kkimag(xx))grid
title('Imag part of IDFT\{X[k]\}')
xlabel('Time index n')
ylabel('Amplitude')
N100L200时图:
Q324 写MATLAB程序N点复数离散傅里叶计算两长度N实数序列N点离散傅里叶变换结果直接两N点离散傅里叶变换结果进行较
clf
N256
nn [0N1]
ntime [N2N21]
g (075)^abs(ntime)
h (09)^ntime
GF fft(g)
HF fft(h)
x g + i*h
XF fft(x)
XFstar conj(XF)
XFstarmod [XFstar(1) fliplr(XFstar(2N))]
GF2 05*(XF + XFstarmod)
HF2 i*05*(XF XFstarmod)
abs(max(GFGF2))
abs(max(HFHF2))
figure(1)clf
subplot(221)grid
plot(nnreal(GF))grid
title('Two Npoint DFT''s')
xlabel('Frequency index k')
ylabel('Re\{G[k]\}')
subplot(222)
plot(nnimag(GF))grid
title('Two Npoint DFT''s')
xlabel('Frequency index k')
ylabel('Im\{G[k]\}')
subplot(223)grid
plot(nnreal(GF2))grid
title('Single Npoint DFT')
xlabel('Frequency index k')
ylabel('Re\{G[k]\}')
subplot(224)
plot(nnimag(GF2))grid
title('Single Npoint DFT')
xlabel('Frequency index k')
ylabel('Im\{G[k]\}')
figure(2)clf
subplot(221)grid
plot(nnreal(HF))grid
title('Two Npoint DFT''s')
xlabel('Freq index k')
ylabel('Re\{H[k]\}')
subplot(222)
plot(nnimag(HF))grid
title('Two Npoint DFT''s')
xlabel('Freq index k')
ylabel('Im\{H[k]\}')
subplot(223)grid
plot(nnreal(HF2))grid
title('Single Npoint DFT')
xlabel('Freq index k')
ylabel('Re\{H[k]\}')
subplot(224)
plot(nnimag(HF2))grid
title('Single Npoint DFT')
xlabel('Freq index k')
ylabel('Im\{H[k]\}')
Q326 函数circshift中命令rem作什?
答:rem(xy)yx求余数函数
Q327 解释函数circshift样实现圆周移位运算
答:输入序列xM位置开始循环移位果M> 0circshift删矢量x左边开始M元素附加右侧剩余元素获循环移位序列果果M<0circshift首先通x长度弥补M序列x右边长度M样品x中删附余M样右侧获循环移位序列
Q328 函数circshift中运算符~作什?
答:~等意思
Q329 解释函数circonv样实现圆周卷积运算
答:输入两长度L量x1x2非常定期延长X2函数x2p成x2延长限长周期序列概念讲定点时间通时序交换x2p长度L交换x2p序列x2tr等1元素然元素1L输出量y通取x1获长度Lsh矢量间积通循环右移时间反转量x2tr输出样Y[n]1≤N≤L时右循环移位量n1位置
Q336 运行程序P39验证离散傅里叶变换圆周卷积性质
g1[1 2 3 4 5 6]g2[1 2 3 3 2 1]
ycircirconv(g1g2)
disp('圆周卷积结果')disp(ycir)
G1fft(g1)G2fft(g2)
ycreal(ifft(G1*G2))
disp('离散傅里叶变换积离散傅里叶逆变换结果')disp(yc)
function ycirconv(x1x2)
L1length(x1)L2length(x2)
if L1~L2error('长度相等序列')end
yzeros(1L1)
x2tr[x2(1) x2(L212)]
for k1L1
shcircshift(x2tr1k)
hx1*sh
y(k)sum(h)
end
圆周卷积结果
12 12 12 12 12 12
离散傅里叶变换积离散傅里叶逆变换结果
12 28 14 0 16 14
Q338 运行程序P310验证线性卷积通圆周卷积
Linear convolution via circular convolution
2 6 10 15 21 15 7 9 5
Direct linear convolution
2 6 10 15 21 15 7 9 5
圆周卷积确实线性卷积
Q340 编写MATLAB程序两序列做离散傅里叶变换已生成线性卷积程序验证Q338Q339结果
编写MATLAB程序:
g1 [1 2 3 4 5]
g2 [2 2 0 1 1]
g1e [g1 zeros(1length(g2)1)]
g2e [g2 zeros(1length(g1)1)]
G1EF fft(g1e)
G2EF fft(g2e)
ylin real(ifft(G1EF*G2EF))
disp('Linear convolution via DFT ')
disp(ylin)
Linear convolution via DFT
20000 60000 100000 150000 210000 150000 70000 90000 50000
Q346 程序P31单位圆求面z变换:
G(z)
函数zplane容易理Z变换G(z)极零点图该函数两种形式Z变换式(332)示理函数形式出命令zplane(numden) 中numdenz^1升幂排列G(z)分子分母项式系数行量外出G(z)零点极点命令zplane(zerospoles)中zerospoles列量matlab产生极零点图中点位置符号x表示零点位置符号o表示
结果图:
Q347 编写MATLAB程序计算显示零点极点计算显示式形式产生z两项式形式表示z变换极零点图该程序分析式(332)z变换G(z)
编写MATLAB程序:
clf
initialize
num [2 5 9 5 3]
den [5 45 2 1 1]
[z p k] tf2zpk(numden)
disp('Zeros')
disp(z)
disp('Poles')
disp(p)
input('Hit
[sos k] zp2sos(zpk)
input('Hit
zplane(zp)
运行结果:
Zeros
10000 + 14142i
10000 14142i
02500 + 06614i
02500 06614i
Poles
89576
02718
01147 + 02627i
01147 02627i
sos
10000 20000 30000 10000 92293 24344
10000 05000 05000 10000 02293 00822
k
04000
Q348 通题Q347产生极零点图求出G(z)收敛域数目清楚显示收敛域极零点图说明离散时间傅里叶变换否存
R1 | z | < 02718 (leftsided not stable)
R2 02718 < | z | < 02866 (twosided not stable)
R 3 02866 < | z | < 89576 (twosided stable)
R4 | z | > 89576 (rightsided not stable)
极零点图肯定说DTFT否存收敛域定指定收敛域述R 3获序列证明DTFT存具双面激响应稳定系统
Q350 编写MATLAB程序计算理逆z变换前L样中L值户通命令input提供该程序计算画出式(332)中G(z)逆变换前50样命令stem画出逆变换产生序列
编写MATLAB程序:
clf
num [2 5 9 5 3]
den [5 45 2 1 1]
L input('Enter the number of samples L ')
[g t] impz(numdenL)
stem(tg)
title(['First 'num2str(L)' samples of impulse response'])
xlabel('Time Index n')
ylabel('h[n]')
Enter the number of samples L 50
实验名称:数字滤波器频域分析实现
实验目务:
(1)求滤波器幅度响应相位响应观察称性判断滤波器类型
(2)Matlab函数实现系统级联型联型结构滤波器进行结构仿真
二实验容:
系统传递函数级联联实现:Q61 Q63 Q65 Q83Q85
滤波器幅频特性分析:Q81 Q89Q810Q814
三实验程结果分析:
Q61 程序P61生成限激响应传输函数级联实现:
H(z)2+10z+23z+34z+31z+16z
编写MATLAB程序:
Program P6_1
num input('Numerator coefficient vector ')
den input('Denominator coefficient vector ')
[ba] eqtflength(numden) make lengths equal
[zpk] tf2zp(ba)
sos zp2sos(zpk)
Numerator coefficient vector [2 10 23 34 31 16 4]
Denominator coefficient vector [1]
sos
20000 60000 40000 10000 0 0
10000 10000 20000 10000 0 0
10000 10000 05000 10000 0 0
画出级联实现框图:
H(z)线性相位传输函数
Q63 程序P61H(z)
Numerator coefficient vector [3 8 12 7 2 –2]
Denominator coefficient vector [16 24 24 14 5 1]
sos
01875 00625 0 10000 05000 0
10000 20000 20000 10000 05000 02500
10000 10000 10000 10000 05000 05000
画出级联实现框图:
Q65 程序P62式H(z)示果限激响应传输函数两种联形式实现画出两种实现框图:
Parallel Form I
Residues are
04219 + 06201i
04219 06201i
23437
03437 25079i
03437 + 25079i
Poles are at
02500 + 06614i
02500 06614i
05000
02500 + 04330i
02500 04330i
Constant value
2
Parallel Form II
Residues are
03047 04341i
03047 + 04341i
11719
10000 + 07758i
10000 07758i
Poles are at
02500 + 06614i
02500 06614i
05000
02500 + 04330i
02500 04330i
Constant value
01875
Q81 程序P81设计滤波器类型 IIR带阻滤波器 指标 [04 05] [01 08] R1dBR30dB滤波器阶数 4 验证仿真需计算激响应样 5仿真正确?
Program P8_1
Wp [04 05] Ws [01 08] Rp 1 Rs 30
[N1 Wn1] buttord(Wp Ws Rp Rs)
[numden] butter(N1Wn1)
disp('Numerator coefficients are ')disp(num)
disp('Denominator coefficients are ')disp(den)
impres direct2(numden[1 zeros(14*N1)])
[pd] strucver(impres2*N1)
disp('Actual numerator coeffs are ') disp(p')
disp('Actual denominator coeffs are ') disp(d')
Numerator coefficients are
00571 0 01143 0 00571
Denominator coefficients are
10000 05099 12862 03350 04479
Actual numerator coeffs are
00571 00000 01143 00000 00571
Actual denominator coeffs are
10000 05099 12862 03350 04479
直接II型结构果限激响应滤波器滤波器阶数4阶
Q83 生成Q81中产生传输函数级联实现编写程序仿真中单独部分直接Ⅱ型实现验证仿真
format short
num input('Numerator coefficients ')
den input('Denominator coefficients ')
Numfactors factorize(num)
Denfactors factorize(den)
disp('Numerator Factors')disp(Numfactors)
disp('Denominator Factors')disp(Denfactors)
Numerator coefficients [00571 0 01143 0 00571]
Denominator coefficients [10000 05099 12862 03350 04479]
Numerator Factors
Columns 1 through 3
1000000000000000 1021143238995107 0
1000000000000000 0979294541463240 0
1000000000000000 1021143238995070 0
1000000000000000 0979294541463277 0
Denominator Factors
Columns 1 through 3
1000000000000000 0597633166080704 0678485370310279
1000000000000000 0087733166080704 0660146879504817
Q85 生成Q81中传输函数联Ⅰ型实现编写程序仿真单独部分直接Ⅱ型实现验证仿真
num input('Numerator coefficient vector ')
den input('Denominator coefficient vector ')
[r1p1k1] residuez(numden)
[r2p2k2] residue(numden)
disp('Parallel Form I')
disp('Residues are')disp(r1)
disp('Poles are at')disp(p1)
disp('Constant value')disp(k1)
disp('Parallel Form II')
disp('Residues are')disp(r2)
disp('Poles are at')disp(p2)
disp('Constant value')disp(k2)
[b1a1]residuez(R1P10)
R1[r1(1) r1(2) r1(3) r1(4)]
P1[p1(1) p1(2) p1(3) p1(4)]
disp('b1')disp(b1)
disp('a1')disp(a1)
Numerator coefficient vector [00571 0 01143 0 00571]
Denominator coefficient vector [10000 05099 12862 03350 04479
]
Parallel Form I
Residues are
0023475623417519 + 0197736845648730i
0023475623417519 0197736845648730i
0011716283258078 0213037612139943i
0011716283258078 + 0213037612139943i
Poles are at
0298816583040352 + 0767589747202480i
0298816583040352 0767589747202480i
0043866583040352 + 0811309190381311i
0043866583040352 0811309190381311i
Constant value
0127483813351194
Parallel Form II
Residues are
0158795680938490 + 0041067400713457i
0158795680938490 0041067400713457i
0173353325938490 0000160296180734i
0173353325938490 + 0000160296180734i
Poles are at
0298816583040352 + 0767589747202480i
0298816583040352 0767589747202480i
0043866583040352 + 0811309190381311i
0043866583040352 0811309190381311i
Constant value
0057100000000000
b1
0046951246835039 0289531739579519 0
a1
1000000000000000 0597633166080704 0678485370310279
Q89 程序P83设计滤波器类型 IIR低通椭圆滤波器 指标025 055R05dBR50dB阶数 8输入正弦序列频率f07kHz
Program P8_3
Illustration of Filtering by an IIR Filter
clf
Generate the input sequence
k 050
w2 07*piw1 02*pi
x1 15*cos(w1*k) x2 2*cos(w2*k)
x x1+x2
Determine the filter transfer function
[N Wn] ellipord(025 055 05 50)
[num den] ellip(N05 50Wn)
Generate the output sequence
y filter(numdenx)
Plot the input and the output sequences
subplot(211)
stem(kx) grid axis([0 50 4 4])
xlabel('Time index n') ylabel('Amplitude')
title('Input Sequence')
subplot(212)
stem(ky) grid axis([0 50 4 4])
xlabel('Time index n') ylabel('Amplitude')
title('Output Sequence')
Q810 运行P83产生两图形种输入成分会滤波器输出出现?什输出序列开始部分种理想正弦曲线?修改P83便纸滤序列X2[n]产生输出序列预料样?
答:产生输出序列预料样
Q814 程序P84设计滤波器类型 FIR低通滤波器指标[0 03] [05 ] 阶数 9 验证仿真需计算激响应样 10仿真正确?
答:滤波器类型 FIR低通滤波器指标[0 03] [05 ] 阶数 9 验证仿真需计算激响应样 10仿真正确
实验名称:数字滤波器设计
实验目务:
(1)窗口法设计满足指标FIR数字滤波器
(2)模拟低通滤波器原型设计IIR数字滤波器
(3)选定信号滤波问题设计数字滤波器验证滤波效果
二实验容:
阅读Page 9193相应函数程序P71完成Q71 Q75Q76
阅读Page 9496相应函数 完成Q79Q713Q714Q720
sinc函数功通help查询:
MatlabHelpSearchFunction Name输入sinc
实验指导书Page 49sinc函数实例
幅度响应分析:
通DTFT定义计算幅度响应
通freqz函数分析
三实验程结果分析:
Q71 MATLAB确定数字线激响应低通滤波器四种类型低阶数指标:40kHz抽样率4kHZ通带边界频率8kHz阻带边界频率05dB通带波纹40dB阻带衰减评结果
根题意:F40kHzF4 kHzF8kHz通带增益R05dB阻带增益R40dB
出
W
W
(1) 根述数buttord函数[N Wn] buttord(02040540)巴特沃兹滤波器低阶数N8
Wn02469 02469
(2) 根述数cheb1ord函数[N Wn] cheb1ord(02040540)切雪夫1型滤波器低阶数N5
Wn02000 02000
(3) 根述数cheb2ord函数[N Wn] cheb1ord(02040540)切雪夫2型滤波器低阶数N5
Wn04000 04000
(4) 根述数ellipord函数[N Wn] ellipord (0204
0540)椭圆滤波器低阶数N4
Wn02000 02000
Q75 通运行P71设计巴特沃兹带阻滤波器写出产生传输函数准确表达式滤波器指标什?MATLAB计算绘制滤波器未畸变相位相应群延迟相应
MATLAB程序:
Program P7_1
Design of a Butterworth Bandstop Digital Filter
Ws [04 06] Wp [02 08] Rp 04 Rs 50
Estimate the Filter Order
[N1 Wn1] buttord(02 04 05 40)
Design the Filter
[numden] butter(N1Wn1'stop')
Display the transfer function
disp('Numerator Coefficients are ')disp(num)
disp('Denominator Coefficients are ')disp(den)
Compute the gain response
[g w] gain(numden)
Plot the gain response
plot(wpig)grid
axis([0 1 60 5])
xlabel('\omega \pi') ylabel('Gain in dB')
title('Gain Response of a Butterworth Bandstop Filter')
:
Numerator Coefficients are
Columns 1 through 9
00493 00000 02465 00000 04930 00000 04930 00000 02465
Columns 10 through 11
00 00493
Denominator Coefficients are
Columns 1 through 9
10000 00000 00850 00000 06360 00000 00288 00000 00561
Columns 10 through 11
00000 00008
表达式:
H (z)
指标02040608R04dBR50dB
Q76 修改P71设计符合题Q71指标切雪夫1型低通滤波器写出产生传输函数准确表达式MATLAB计算绘制滤波器未畸变相位相应群延迟响应
修改P71程序(切雪夫1型低通滤波器):
Program Q7_6
Design spec as given in Q71
FT 40*10^3 sampling freq
Fp 4*10^3 analog passband edge freq
Fs 8*10^3 analog stopband edge freq
Rp 05 max passband ripple dB
Rs 40 min stopband attenuation dB
Convert spec to normalized digital frequencies
omega_p 2*pi*FpFT
Wp 2*FpFT omega_ppi
omega_s 2*pi*FsFT
Ws 2*FsFT omega_spi
Estimate the Filter Order
[N Wn] cheb1ord(Wp Ws Rp Rs)
Design the Filter
[numden] cheby1(NRpWn)
Display the transfer function
disp('Numerator Coefficients are ')disp(num)
disp('Denominator Coefficients are ')disp(den)
Compute the gain response
[g w] gain(numden)
Plot the gain response
figure(1)
plot(wpig)grid
axis([0 1 60 5])
xlabel('\omega \pi') ylabel('Gain in dB')
title('Gain Response of a Type 1 Chebyshev Lowpass Filter')
Find and plot the phase
figure(2)
w2 0pi511pi
Hz freqz(numdenw2)
Phase unwrap(angle(Hz))
plot(w2piPhase)grid
xlabel('\omega \pi') ylabel('Unwrapped Phase (rad)')
title('Unwrapped Phase Response of a Type 1 Chebyshev Lowpass Filter')
Find and plot the group delay
figure(3)
GR grpdelay(numdenw2)
plot(w2piGR)grid
xlabel('\omega \pi') ylabel('Group Delay (sec)')
title('Group Delay of a Type 1 Chebyshev Lowpass Filter')
编写MATLAB程序(计算未畸变相位响应群延迟响应):
Program Q7_6
Ws [04 06] Wp [02 08] Rp 04 Rs 50
Estimate the Filter Order
[N1 Wn1] buttord(Wp Ws Rp Rs)
Design the Filter
[numden] butter(N1Wn1'stop')
Find the frequency response find and plot unwrapped phase
wp 0pi1023pi
wg 0pi511pi
Hz freqz(numdenwp)
Phase unwrap(angle(Hz))
figure(1)
plot(wppiPhase)
grid
axis([0 1 a b])
xlabel('\omega \pi') ylabel('Unwrapped Phase (rad)')
title('Unwrapped Phase Response of a Butterworth Bandstop Filter')
Find and plot the group delay
GR grpdelay(numdenwg)
figure(2)
plot(wgpiGR)
grid
axis([0 1 a b])
xlabel('\omega \pi') ylabel('Group Delay (sec)')
title('Group Delay of a Butterworth Bandstop Filter')
Q79 sinc编写MATLAB程序产生截止频率04处长度分81614121四零相位低通滤波器激响应系数然计算画出幅度响应号:运算符长度81滤波器激响应系数中抽出较短长度滤波器激响应系数滤波器截止频率两边研究频率响应摆动行波纹数量滤波器长度什关系?波纹高度滤波器长度什关系?样修改述程序产生偶数长度零相位低通滤波器激响应系数?
(1)长度81零相位低通滤波器激响应:
(2)长度61零相位低通滤波器激响应:
(3)长度41零相位低通滤波器激响应:
(4)长度21零相位低通滤波器激响应:
答:图形证明情况幅值振动Gibb效应波纹数量减少滤波器长度成正波纹高度滤波器长度没关系
修改程序产生偶数长度零相位低通滤波器激响应系数:
Program Q7_9
n 395395 this gives us a length of 80
hn_80 04 * sinc(04*n) the length80 impulse response
omega 0pi1023pi radian frequency vector
W omegapi Matlab normalized freq vector
Hz_80 abs(freqz(hn_801omega)) 1024 samles of |H(e^jw)|
figure(1)
plot(WHz_80) grid
xlabel('\omega \pi') ylabel('|H(e^{j\omega})|')
title('Magnitude Response for Length80')
Reduce length to 60 and repeat
hn_60 hn_80(1170)
Hz_60 abs(freqz(hn_601omega))
figure(2)
plot(WHz_60) grid
xlabel('\omega \pi') ylabel('|H(e^{j\omega})|')
title('Magnitude Response for Length60')
Reduce length to 40 and repeat
hn_40 hn_60(1150)
Hz_40 abs(freqz(hn_401omega))
figure(3)
plot(WHz_40) grid
xlabel('\omega \pi') ylabel('|H(e^{j\omega})|')
title('Magnitude Response for Length40')
Reduce length to 20 and repeat
hn_20 hn_40(1130)
Hz_20 abs(freqz(hn_201omega))
figure(4)
plot(WHz_20) grid
xlabel('\omega \pi') ylabel('|H(e^{j\omega})|')
title('Magnitude Response for Length20')
Q713函数kaiord估计具指标线性相位低通限激相应滤波器阶数:通带边界2kHz阻带边界25kHz通带波纹阻带波纹0005抽样率10kHz函数kaiord中命令ceilnargin作什?
答:函数kaiord述数估计N46
命令ceil:正方舍入成整数函数
命令nargin:判断输入变量数函数样针情况执行功通常设定默认值
Q714 面情况重做Q713:(a)20kHz抽样率(b) 00020002(c)阻带边界23kHz种情况中滤波器长度Q713中滤波器长度相作较评抽样率波纹渡带宽滤波器阶数影响
(a)20kHz抽样率时N91
(b) 00020002时N57
(c)阻带边界23kHz时N76
1抽样率滤波器阶数影响:定模拟渡带宽抽样率增长导致估计滤波器阶数成例增长直整数值
2波纹滤波器阶数影响:估计滤波器阶数约波纹log值成定例
3渡带宽滤波器阶数影响:定范围滤波器阶数渡带宽成例变化
课题:
M 22 (a)Using Program2_2generate the sequence shown in Figures 223 and 224
(b)Generate and plot the complex exponential sequence 27e^((04+jπ6)n) for 0≤n≤82 using Program 2_2
Answer
(a) For figure 223
a 112
b pi6
c a + b*i
K 1
N 41
n 1N
x K*exp(c*n)
stem(nreal(x))
xlabel('时间n')ylabel('振幅')
title('实数部分')
disp('PRESS RETURN for imaginary part')
pause
stem(nimag(x))Plot the imaginary part
xlabel('Time index n')ylabel('Amplitude')
title('Imaginary part')
For figure 224(a)
a log(12)
b 0
c a + b*i
K 02
N 31
n 1N
x K*exp(c*n)
stem(nreal(x))
xlabel('时间n')ylabel('振幅')
title('实数部分')
disp('PRESS RETURN for imaginary part')
pause
stem(nimag(x))Plot the imaginary part
xlabel('Time index n')ylabel('Amplitude')
title('Imaginary part')
For figure 224(b)
a log(09)
b 0
c a + b*i
K 20
N 31
n 1N
x K*exp(c*n)
stem(nreal(x))
xlabel('时间n')ylabel('振幅')
title('实数部分')
disp('PRESS RETURN for imaginary part')
pause
stem(nimag(x))Plot the imaginary part
xlabel('Time index n')ylabel('Amplitude')
title('Imaginary part')
(b)
a 04
b pi6
c a + b*i
K 27
N 8
n 1N
x K*exp(c*n)
stem(nreal(x))
xlabel('时间n')ylabel('振幅')
title('实数部分')
disp('PRESS RETURN for imaginary part')
pause
stem(nimag(x))Plot the imaginary part
xlabel('Time index n')ylabel('Amplitude')
title('Imaginary part')
M24
(a)
Linput('desired length ')
Ainput('Amplitude ')
omegainput('angular frequency ')
phi input('phase ')
n0L1
xA*cos(omega*n+phi)
stem(nx)
xlabel('time index' )
ylabel('amplitude')
title(['\omega_{o} 'num2str(omegapi)'\pi'])
(b)
M26
Write a MATLAB program to plot a continuoustime sinusoidal signal and its sampled version and verify Figure 228 You need to use the hold function to keep both plots
t000011
foinput('Frequency of sinusoid in Hz')
FTinput('Sampling frequency in Hz')
g1cos(2*pi*fo*t)
plot(tg1'')
xlabel('time') ylabel('Amplitude') hold
n01FT
gscos(2*pi*fo*nFT)
plot(nFTgs'o') hold off
Frequency of sinusoid in Hz10
Sampling frequency in Hz5
clf
w4*pi8*pi5114*pi
num[01323 001910412 005978637 001910412 01323]
den[1 01386 08258 01393 04153]
hfreqz(numdenw)
subplot(211)
plot(wpireal(h))grid
title('(e^{j\omega})实部')
xlabel('\omega\pi')
ylabel('振幅')
subplot(212)
plot(wpiimag(h))grid
title('H(e^{j\omega}虚部)')
xlabel('\omega\pi')
ylabel('振幅')
pause
subplot(211)
plot(wpiabs(h))grid
title('H(e^{j\omega})实部')
xlabel('\omega\pi')
ylabel('振幅')
subplot(212)
plot(wpiangle(h))grid
title('[H(e^{j\omega})]虚部')
xlabel('\omega\pi')
ylabel('振幅')
clf
w4*pi8*pi5114*pi
num[03192 00601692 00601692 03192]
den[1 07856 14654 02346]
hfreqz(numdenw)
subplot(211)
plot(wpireal(h))grid
title('(e^{j\omega})幅度谱')
xlabel('\omega\pi')
ylabel('振幅')
subplot(212)
plot(wpiimag(h))grid
title('H(e^{j\omega}相位谱)')
xlabel('\omega\pi')
ylabel('振幅')
pause
subplot(211)
plot(wpiabs(h))grid
title('H(e^{j\omega})幅度谱')
xlabel('\omega\pi')
ylabel('振幅')
subplot(212)
plot(wpiangle(h))grid
title('相位谱[H(e^{j\omega})]')
xlabel('\omega\pi')
ylabel('振幅')
M65 Repeat Problem 672 using Matlab
A casual stable LTI discretetime system is characterized by an impulse response h1[n]19δ[n]+05(02)^nu[n]06(07)^nu[n]
Determine the impulse response h2[n] of its inverse systemwhich is causal and stable
h1
Columns 1 through 10
18000 05200 02740 02098 01433 01010
00706 00496 00346 00242
Columns 11 through 20
00169 00119 00083 00058 00041 00028
00020 00014 00010 00007
The first 20 samples of h2[n] are
h2
Columns 1 through 10
05556 01605 01310 01270 01196 01131
01069 01010 00955 00903
Columns 11 through 20
00853 00806 00762 00720 00681 00644
00608 00575 00544 00514
The first 20 samples of the convolution are
Columns 1 through 10
10001 00001 00000 00000 00000
00000 00000 00000 00000 00000
Columns 11 through 20
00000 00000 00000 00000 00000
00000 00000 00000 00000 0000
82
clf
k 050
w2 07*piw1 02*pi
x1 15*cos(w1*k) x2 2*cos(w2*k)
x x1+x2
[N Wn] ellipord(025 055 05 50)
[num den] ellip(N05 50Wn)
y filter(numdenx)
subplot(211)
stem(kx) grid axis([0 50 4 4])
xlabel('Time index n') ylabel('Amplitude')
title('Input Sequence')
subplot(212)
stem(ky) grid axis([0 50 4 4])
xlabel('Time index n') ylabel('Amplitude')
title('Output Sequence')
21 22 33 91
数字信号处理实验结心体会:
文档香网(httpswwwxiangdangnet)户传
《香当网》用户分享的内容,不代表《香当网》观点或立场,请自行判断内容的真实性和可靠性!
该内容是文档的文本内容,更好的格式请下载文档