DSP using MATLAB示例Example3.16

代码:
b = [0.0181, 0.0543, 0.0543, 0.0181]; % filter coefficient array b
a = [1.0000, -1.7600, 1.1829, -0.2781]; % filter coefficient array a
m = 0:length(b)-1; l = 0:length(a)-1; % index arrays m and l
K = 500; k = 0:1:K; % index array k for frequencies
w = k*pi/500; % freqency between 0 and +pi, [0,pi] axis divided into 501 points. num = b * exp(-j*m'*w); % Numerator calculations
den = a * exp(-j*l'*w); % Denominator claculations
H = num ./ den; % Frequency response magH = abs(H); angH = angle(H); realH = real(H); imagH = imag(H); %% --------------------------------------------------------------------
%% START H's mag ang real imag
%% --------------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'Example3.16');
set(gcf,'Color','white');
subplot(2,2,1); plot(w/pi,magH); grid on; axis([0,1,0,1.5]);
title('Magnitude Response');
xlabel('frequency in \pi units'); ylabel('Magnitude |H|');
subplot(2,2,3); plot(w/pi, angH/pi); grid on; % axis([-1,1,-1,1]);
title('Phase Response');
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); subplot('2,2,2'); plot(w/pi, realH); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot('2,2,4'); plot(w/pi, imagH); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary');
%% -------------------------------------------------------------------
%% END X's mag ang real imag
%% -------------------------------------------------------------------
运行结果:
上图看出,是个低通滤波器。
DSP using MATLAB示例Example3.16的更多相关文章
- DSP using MATLAB 示例Example3.21
代码: % Discrete-time Signal x1(n) % Ts = 0.0002; n = -25:1:25; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*a ...
- DSP using MATLAB 示例 Example3.19
代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Discrete-time Signa ...
- DSP using MATLAB示例Example3.18
代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Continuous-time Fou ...
- DSP using MATLAB 示例Example3.23
代码: % Discrete-time Signal x1(n) : Ts = 0.0002 Ts = 0.0002; n = -25:1:25; nTs = n*Ts; x1 = exp(-1000 ...
- DSP using MATLAB 示例Example3.22
代码: % Discrete-time Signal x2(n) Ts = 0.001; n = -5:1:5; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*abs(nT ...
- DSP using MATLAB 示例Example3.17
- DSP using MATLAB 示例 Example3.15
上代码: subplot(1,1,1); b = 1; a = [1, -0.8]; n = [0:100]; x = cos(0.05*pi*n); y = filter(b,a,x); figur ...
- DSP using MATLAB 示例 Example3.13
上代码: w = [0:1:500]*pi/500; % freqency between 0 and +pi, [0,pi] axis divided into 501 points. H = ex ...
- DSP using MATLAB 示例 Example3.12
用到的性质 代码: n = -5:10; x = sin(pi*n/2); k = -100:100; w = (pi/100)*k; % freqency between -pi and +pi , ...
随机推荐
- C#传真传址 结构体
1.传真 传址 namespace 传值_传址 { class Program { //格式1:无参无返 public void LeiJia() { Console.Write("请输入 ...
- 【网络】VPN和代理服务器的区别
来自:http://www.zhihujingxuan.com/19311.html [scotttony的回答(41票)]: VPN和ssh哪个比较好, 要看你怎么定义是“好”. ssh作为一个创建 ...
- JS 保留两位小数问题收集
1.使用四舍五入的方法,保留小数点后的两位小数: toFixed里面的参数表示保留的小数的位数,范围是0-20,超过20位就会报错了 <script> var num=22.127456; ...
- 模拟赛1103d1
取模(mod) [题目描述] 有一个整数a和n个整数b_1, -, b_n.在这些数中选出若干个数并重新排列,得到c_1,-, c_r.我们想保证a mod c_1 mod c_2 mod - mod ...
- python基础——sorted()函数
python基础——sorted()函数 排序算法 排序也是在程序中经常用到的算法.无论使用冒泡排序还是快速排序,排序的核心是比较两个元素的大小.如果是数字,我们可以直接比较,但如果是字符串或者两个d ...
- Mac系统下使用VirtualBox虚拟机安装win7--第二步 创建win7系统
第二步 创建win7系统 启动 Virtual Box 以后,点击窗口左上角的“新建”按钮,如图所示
- MVC学习笔记---ModelBinder
http://www.cnblogs.com/terrysun/archive/2010/04/05/1704666.html http://www.cnblogs.com/aehyok/archiv ...
- 攻城狮在路上(叁)Linux(十九)--- 磁盘分区
磁盘分区使用fdisk命令,该命令仅root有使用权限. 磁盘分区的一般步骤: 1.首先用df命令查看设备名 df -h; 2.fdisk /dev/sda; <== 按m显示help d:删除 ...
- <转>JDBC获取DB元数据
原文链接:http://jiauwu.iteye.com/blog/1307617 package com.util.jdbc; import java.sql.Connection; import ...
- js 横幅播放
js 横幅播放 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www ...