《DSP using MATLAB》Problem 8.10
代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 8.10 \n\n');
banner();
%% ------------------------------------------------------------------------ %a0 = 0.90;
%a0 = 0.95;
a0 = 0.99;
% digital iir 1st-order allpass filter
b = [a0 1];
a = [1 a0]; figure('NumberTitle', 'off', 'Name', 'Problem 8.10 Pole-Zero Plot')
set(gcf,'Color','white');
zplane(b,a);
title(sprintf('Pole-Zero Plot, r=%.2f',a0));
%pzplotz(b,a); [db, mag, pha, grd, w] = freqz_m(b, a); % ---------------------------------------------------------------------
% Choose the gain parameter of the filter, maximum gain is equal to 1
% ---------------------------------------------------------------------
gain1=max(mag) % with poles
K = 1
[db, mag, pha, grd, w] = freqz_m(K*b, a); figure('NumberTitle', 'off', 'Name', 'Problem 8.10 IIR allpass filter')
set(gcf,'Color','white'); subplot(2,2,1); plot(w/pi, db); grid on; axis([0 2 -60 10]);
set(gca,'YTickMode','manual','YTick',[-60,-30,0])
set(gca,'YTickLabelMode','manual','YTickLabel',['60';'30';' 0']);
set(gca,'XTickMode','manual','XTick',[0,0.25,0.5,1,1.5,1.75,2]);
xlabel('frequency in \pi units'); ylabel('Decibels'); title('Magnitude Response in dB'); subplot(2,2,3); plot(w/pi, mag); grid on; %axis([0 1 -100 10]);
xlabel('frequency in \pi units'); ylabel('Absolute'); title('Magnitude Response in absolute');
set(gca,'XTickMode','manual','XTick',[0,0.25,0.5,1,1.5,1.75,2]);
set(gca,'YTickMode','manual','YTick',[0,1.0]); subplot(2,2,2); plot(w/pi, pha); grid on; %axis([0 1 -100 10]);
xlabel('frequency in \pi units'); ylabel('Rad'); title('Phase Response in Radians'); subplot(2,2,4); plot(w/pi, grd*pi/180); grid on; %axis([0 1 -100 10]);
xlabel('frequency in \pi units'); ylabel('Rad'); title('Group Delay');
set(gca,'XTickMode','manual','XTick',[0,0.25,0.5,1,1.5,1.75,2]);
%set(gca,'YTickMode','manual','YTick',[0,1.0]); figure('NumberTitle', 'off', 'Name', 'Problem 8.10 IIR allpass filter')
set(gcf,'Color','white');
plot(w/pi, -pha/w); grid on; %axis([0 1 -100 10]);
xlabel('frequency in \pi units'); ylabel('Rad'); title('Phase Delay in samples'); % Impulse Response
fprintf('\n----------------------------------');
fprintf('\nPartial fraction expansion method: \n');
[R, p, c] = residuez(K*b,a)
MR = (abs(R))' % Residue Magnitude
AR = (angle(R))'/pi % Residue angles in pi units
Mp = (abs(p))' % pole Magnitude
Ap = (angle(p))'/pi % pole angles in pi units
[delta, n] = impseq(0,0,50);
h_chk = filter(K*b,a,delta); % check sequences % ------------------------------------------------------------------------------------------------
% gain parameter K
% ------------------------------------------------------------------------------------------------
%h = -0.2111 * ((-0.9) .^ n) + 1.1111 * delta; %r=0.90
%h = -0.1026 * ((-0.95) .^ n) + 1.0526 * delta; %r=0.95
h = -0.0201 * ((-0.99) .^ n) + 1.0101 * delta; %r=0.99
% ------------------------------------------------------------------------------------------------ figure('NumberTitle', 'off', 'Name', 'Problem 8.10 IIR allpass filter, h(n) by filter and Inv-Z ')
set(gcf,'Color','white'); subplot(2,1,1); stem(n, h_chk); grid on; %axis([0 2 -60 10]);
xlabel('n'); ylabel('h\_chk'); title('Impulse Response sequences by filter'); subplot(2,1,2); stem(n, h); grid on; %axis([0 1 -100 10]);
xlabel('n'); ylabel('h'); title('Impulse Response sequences by Inv-Z'); [db, mag, pha, grd, w] = freqz_m(h, 1); figure('NumberTitle', 'off', 'Name', 'Problem 8.10 IIR filter, h(n) by Inv-Z ')
set(gcf,'Color','white'); subplot(2,2,1); plot(w/pi, db); grid on; axis([0 2 -60 10]);
set(gca,'YTickMode','manual','YTick',[-60,-30,0])
set(gca,'YTickLabelMode','manual','YTickLabel',['60';'30';' 0']);
set(gca,'XTickMode','manual','XTick',[0,0.25,1,1.75,2]);
xlabel('frequency in \pi units'); ylabel('Decibels'); title('Magnitude Response in dB'); subplot(2,2,3); plot(w/pi, mag); grid on; %axis([0 1 -100 10]);
xlabel('frequency in \pi units'); ylabel('Absolute'); title('Magnitude Response in absolute');
set(gca,'XTickMode','manual','XTick',[0,0.25,1,1.75,2]);
set(gca,'YTickMode','manual','YTick',[0,1.0]); subplot(2,2,2); plot(w/pi, pha); grid on; %axis([0 1 -100 10]);
xlabel('frequency in \pi units'); ylabel('Rad'); title('Phase Response in Radians'); subplot(2,2,4); plot(w/pi, grd*pi/180); grid on; %axis([0 1 -100 10]);
xlabel('frequency in \pi units'); ylabel('Rad'); title('Group Delay');
set(gca,'XTickMode','manual','XTick',[0,0.25,1,1.75,2]);
%set(gca,'YTickMode','manual','YTick',[0,1.0]);
运行结果:
第1、2小题的图这里不放了。
相位延迟phase-delay为0.01时对应的a 的值0.9802
此时1阶全通系统的留数、极点为
系统零极点图
该系统部分分式展开后,求逆z变换得脉冲响应
由下图知,两种方法得到的系统脉冲响应h的幅度谱、相位谱、群延迟大致类似(ω=π时不同)。
《DSP using MATLAB》Problem 8.10的更多相关文章
- 《DSP using MATLAB》Problem 7.10
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 6.10
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 5.10
代码: 第1小题: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Out ...
- 《DSP using MATLAB》Problem 4.10
今天擦完了玻璃,尽管有地方不那么明亮干净,冷风中瑟瑟发抖,年也快临近了. 代码是从网上找的, function [p, np, r, nr] = deconv_m(b, nb, a, na) % Mo ...
- 《DSP using MATLAB》Problem 3.10
用到了三角窗脉冲序列,各小题的DTFT就不写公式了,直接画图(这里只贴长度M=10的情况). 1. 代码: %% ------------------------------------------- ...
- 《DSP using MATLAB》Problem 2.10
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 7.27
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.26
注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.25
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
随机推荐
- Rsync 参数
# rsync -v, --verbose 详细模式输出 -q, --quiet 精简输出模式 -c, --checksum 打开校验开关,强制对文件传输进行校验 -a, --archive 归档模式 ...
- LightOJ 1151 Snakes and Ladders 期望dp+高斯消元
题目传送门 题目大意:10*10的地图,不过可以直接看成1*100的,从1出发,要到达100,每次走的步数用一个大小为6的骰子决定.地图上有很多个通道 A可以直接到B,不过A和B大小不确定 而且 ...
- java多线程-AbstractQueuedSynchronizer
大纲: AbstractQueuedSynchronizer简介 aqs基本结构 aqs应用-ReentrantLock.lock aqs应用-ReentrantLock.unlock aqs应用-S ...
- excel批量删除sql语句
数据如下表一样 在E1列输入update sql 模板 ="update test set A= '"&A1&"' ,B = '"&B1 ...
- Iview+Vue CDN NetMvC 简单demo
1.引用相关js文件 2.菜单采用静态数据加载 3.效果展示 4.代码下载 https://github.com/sulin888/NetVueAdmin.git
- 2019/11/1 CSP模拟
写在前面的反思 该拿的部分分还是得拿完啊,因为懒+动作慢没有写最后一道题的菊花图和链的情况,其实这两个点并不难.. 虽然只有\(10pts\),但是已经足够往上爬一截了啊,额外的\(10pts\)在今 ...
- VS2010-MFC(常用控件:组合框控件Combo Box)
转自:http://www.jizhuomi.com/software/189.html 上一节讲了列表框控件ListBox的使用,本节主要讲解组合框控件Combo Box.组合框同样相当常见,例如, ...
- System.Convert.cs
ylbtech-System.Convert.cs 1. 程序集 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c56 ...
- JS typeof() parseInt() parseFloat()
判断变量的数据类型:typeof() 使用一元运算符typeof(),可以测试一个变量的类型. typeof()测试的结果是一个类型字符串. typeof()的结果字符串有几种情况: “string” ...
- js加密数据爬取
- 中国空气质量在线监测分析平台是一个收录全国各大城市天气数据的网站,包括温度.湿度.PM 2.5.AQI 等数据,链接为:https://www.aqistudy.cn/html/city_deta ...