《DSP using MATLAB》Problem 8.26


代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 8.26 \n\n'); banner();
%% ------------------------------------------------------------------------ c = [1, 1]; d = [1, 5, 6]; % Numerator and Denominator of Ha(s)
T = 0.2; Fs = 1/T; % Sample interval %[b, a] = imp_invr(c, d, T) % digital Num and Deno coefficients of H(z)
[b, a] = mzt(c, d, T) % digital Num and Deno coefficients of H(z) % Calculation of Impulse Response:
%[hs, xs, ts] = impulse(c, d);
figure('NumberTitle', 'off', 'Name', 'Problem 8.26 Imp & Freq Response')
set(gcf,'Color','white');
t = [0:0.01:4]; subplot(2,1,1); impulse(c,d,t); grid on; % Impulse response of the analog filter
axis([0,4,-0.1,1]);hold on n = [0:1:4/T]; hn = filter(b,a,impseq(0,0,4/T)); % Impulse response of the digital filter
stem(n*T,hn); xlabel('time in sec'); title (sprintf('Impulse Responses, T=%.2f',T));
hold off %n = [0:1:29];
%hz = impz(b, a, n); % Calculation of Frequency Response:
[dbs, mags, phas, wws] = freqs_m(c, d, 2*pi/T); % Analog frequency s-domain [dbz, magz, phaz, grdz, wwz] = freqz_m(b, a); % Digital z-domain %% -----------------------------------------------------------------
%% Plot
%% ω = ΩT = 2πF/fs
%% ----------------------------------------------------------------- M = 1/T; % Omega max subplot(2,1,2); plot(wws/(2*pi),mags*Fs,'b', wwz/(2*pi)*Fs,magz,'r'); grid on; xlabel('frequency in Hz'); title('Magnitude Responses'); ylabel('Magnitude'); text(1.4,.5,'Analog filter'); text(1.5,1.5,'Digital filter');
运行结果:





可以看出,采样间隔T越小,数字滤波器幅度响应越接近模拟滤波器。
《DSP using MATLAB》Problem 8.26的更多相关文章
- 《DSP using MATLAB》Problem 7.26
注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 4.26
Y(z)部分分式展开, 零状态响应和零输入响应的部分分式展开,
- 《DSP using MATLAB》Problem 5.24-5.25-5.26
代码: function y = circonvt(x1,x2,N) %% N-point Circular convolution between x1 and x2: (time domain) ...
- 《DSP using MATLAB》Problem 7.16
使用一种固定窗函数法设计带通滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 6.8
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 2.16
先由脉冲响应序列h(n)得到差分方程系数,过程如下: 代码: %% ------------------------------------------------------------------ ...
- 《DSP using MATLAB》Problem 7.32
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.30
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.27
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
随机推荐
- 了解JNI技术
在线文库系统用到了Jacob,它是基于JNI技术实现的,通过调用MS Office的Com接口实现,我这里对JNI技术进行一个学习. 基本上JNI技术相当于一个代理,因为java的跨平台特性,所以它自 ...
- ios 中倒计时计算,时间戳为NaN
// 倒计时 daojishi(params) { let _this = this; let datetemp = this.servertimes; let lasttime = Date.par ...
- leetcood学习笔记-53*-最大子列和
题目描述: 方法一:O(N) class Solution(object): def maxSubArray(self, nums): sum = 0 max_sub_sum = nums[0] fo ...
- python 怎么像shell -x 一样追踪脚本运行过程
python 怎么像shell -x 一样追踪脚本运行过程 [root@localhost keepalived]# python -m trace --trace mysql_start.py -- ...
- 【JZOJ3424】粉刷匠
description 赫克托是一个魁梧的粉刷匠,而且非常喜欢思考= = 现在,神庙里有N根排列成一直线的石柱,从1到N标号,长老要求用油漆将这些石柱重新粉刷一遍.赫克托有K桶颜色各不相同的油漆,第i ...
- 10月23日——作业1——while循环练习
while循环'''此类编程题,注意带进去试一试1.九九乘法表row=1while row<=9: col=1 while col<=row: print(col,"*" ...
- cocos2D-X 常用功能封装
Packaging_Kernel.h #pragma once #include <string> #include <map> #include <vector> ...
- Perl 数据类型
Perl 数据类型 Perl 是一种弱类型语言,所以变量不需要指定类型,Perl 解释器会根据上下文自动选择匹配类型. Perl 有三个基本的数据类型:标量.数组.哈希.以下是这三种数据类型的说明: ...
- Jmeter插件:jp@gc - Dummy Sampler
Dummy Sampler可以比较方便地模拟测试场景,自定义Request Data和Response Data 1. 安装插件:打开页面插件管理网站,下载plugins-manager.jar. 在 ...
- Spring MVC(十四)--SpringMVC验证表单
在Spring MVC中提供了验证器可以进行服务端校验,所有的验证都必须先注册校验器,不过校验器也是Spring MVC自动加载的,在使用Spring MVC校验器之前首先要下载相关的jar包,下面是 ...