代码:

%% ------------------------------------------------------------------------
%% 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的更多相关文章

  1. 《DSP using MATLAB》Problem 7.26

    注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...

  2. 《DSP using MATLAB》Problem 4.26

    Y(z)部分分式展开, 零状态响应和零输入响应的部分分式展开,

  3. 《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) ...

  4. 《DSP using MATLAB》Problem 7.16

    使用一种固定窗函数法设计带通滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

  5. 《DSP using MATLAB》Problem 6.8

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  6. 《DSP using MATLAB》Problem 2.16

    先由脉冲响应序列h(n)得到差分方程系数,过程如下: 代码: %% ------------------------------------------------------------------ ...

  7. 《DSP using MATLAB》Problem 7.32

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  8. 《DSP using MATLAB》Problem 7.30

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  9. 《DSP using MATLAB》Problem 7.27

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

随机推荐

  1. Linux网络配置 RPM命令 samba服务 Linux目录结构

    第一种方法: (1)用root身份登录,运行setup命令进入到 text mode setup utiliy对网络进行配置,这里可以进行ip,子网掩码,默认网关,dns的设置.(2)这时网卡的配置没 ...

  2. Spring Cloud高级视频

    Spring Cloud高级视频 第一章 微服务架构概述 第二章 开始使用Spring Cloud实战微服务 第三章 服务提供者与服务消费者 第四章 服务发现与服务注册 第五章 使用Hystrix保护 ...

  3. Vue项目如何关闭Eslint检测

    找到build/webpack.base.config.js文件,修改如下 将图中第二个红色框的内容 "createLintingRule()" 清空,然后保存重新启动项目即可.

  4. mysql中重复数据只取条

    select * from table_a where id in (select min(id) from table_a group by a) )) SUBSTRING_INDEX(cids,' ...

  5. VM 设置windows与Ubuntu 共享文件

    虚拟机  --->  设置  --->  选项   --->   共享文件夹   --->   选择总是启用 添加Windows下的路径   --->   确定 1. 先 ...

  6. mysql 监控及优化——转载自http://www.cnblogs.com/suansuan/

    1.Mysql连接数 Mysql默认最大连接数为100. 设置Mysql的最大连接数,在Mysql的配置文件中增加: max_connections = 1000   #Mysql的最大连接数,默认如 ...

  7. luoguP1062 数列 [数学]

    题目描述 给定一个正整数k(3≤k≤15),把所有k的方幂及所有有限个互不相等的k的方幂之和构成一个递增的序列,例如,当k=3时,这个序列是: 1,3,4,9,10,12,13,… (该序列实际上就是 ...

  8. 关于IDEA中maven项目中在pom.xml导入依赖报错的解决方法

    报错详情 今天使用springcloud中的hystrix做服务降级的时候,导入下面的依赖,出现红色波浪线的报错信息 <dependency> <groupId>org.spr ...

  9. Docker系列(六):Docker网络机制(下)

    Linux Namespace详解 namespace:是一个空间,空间里可以放进程,文件系统,账号,网络等,某个资源被放到namespace之后 别人就看不到他了. 可以看到有两个namespace ...

  10. MDK 添加芯片支持 以STM32F103ZE为例

    问题说明: 新建mdk工程时第一步是选芯片(以STM32F103ZE为例),但是芯片没有的话需要自己手动添加,如图: 解决方法: 下载KEIL MDK5以后是没有安装device的,如果此时创建工程会 ...