《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 ...
随机推荐
- 《构建之法》CH5~6读书笔记 PB16110698 第九周(~5.15)
这段时间我阅读了<构建之法>的大部分章节,包括个人技能.软件测试.用户体验和需求分析等相关内容.之前的个人作业和结对作业结束后,我们的工作重心终于转向了团队项目,作为团队中前端组的组长,我 ...
- wish - 简单的窗口式(windowing) shell
总览 wish [filename] [arg] [arg ...] 选项 -colormap new 指定窗口使用一个新的私有的调色板(colormap)而不使用给屏幕的缺省的调色板. -displ ...
- JS对象 Date 日期对象 日期对象可以储存任意一个日期,并且可以精确到毫秒数(1/1000 秒)。 定义一个时间对象 : var Udate=new Date();Date()的首字母须大写
Date 日期对象 日期对象可以储存任意一个日期,并且可以精确到毫秒数(1/1000 秒). 定义一个时间对象 : var Udate=new Date(); 注意:使用关键字new,Date()的首 ...
- pdfkit
官方文档 0.准备 需要引入两个包,首先要npm install pdfkit安装pdfkit包 const PDF = require('pdfkit'); const fs = require(' ...
- LCD Common电压
因为驱动液晶翻转靠的是两个玻璃电极上的电压差,而电压差是由电容提供的,电容一端接到S基,另一端接到一个基准电压上,这个电压就是Common电压.
- DDOS 单例
DDOS.H #pragma once //g++ ../../../Main.cpp ../../../DDOS.cpp -lpthread #include <stdio.h> #in ...
- python相关软件安装流程图解——虚拟机操作——复制虚拟机主机——CentOS-7-x86_64-DVD-1810
请先确保已经安装了虚拟机 python相关软件安装流程图解——虚拟机安装——CentOS-7-x86_64-DVD-1810——CentOS-01下载 https://www.cnblogs.com/ ...
- js 常见功能总会
一.随着页面滚动,元素到达可视区域,显示特殊样式 <!DOCTYPE html> <html lang="en"> <head> <met ...
- python的基本数据类型与字符串的操作
一.基本数据类型 (int, bool, str ) int: 整数 str:字符串,一般不存放大量的数据 bool:布尔值,用来判断.True ,Flase list:列表,用来存放大量的数据. [ ...
- .NETFramework-Web.Mvc:HttpXxxAttribute-目录
ylbtech-.NETFramework-Web.Mvc:HttpXxxAttribute-目录 1.返回顶部 2.返回顶部 3.返回顶部 4.返回顶部 5.返回顶部 6.返 ...