《DSP using MATLAB》示例Example 8.22
代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Exameple 8.22 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %8s \n\n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ % Digital Filter Specifications:
wp = 0.2*pi; % digital passband freq in rad
ws = 0.3*pi; % digital stopband freq in rad
Rp = 1; % passband ripple in dB
As = 15; % stopband attenuation in dB % Analog prototype specifications: Inverse Mapping for frequencies
T = 1; % set T = 1
OmegaP = (2/T)*tan(wp/2); % Prewarp(Cutoff) prototype passband freq
OmegaS = (2/T)*tan(ws/2); % Prewarp(cutoff) prototype stopband freq % Analog Prototype Order Calculations:
ep = sqrt(10^(Rp/10)-1); % Passband Ripple Factor
A = 10^(As/20); % Stopband Attenuation Factor
OmegaC = OmegaP; % Analog Chebyshev-1 prototype cutoff freq
OmegaR = OmegaS/OmegaP; % Analog prototype Transition ratio
g = sqrt(A*A-1)/ep; % Analog prototype Intermediate cal N = ceil(log10(g+sqrt(g*g-1))/log10(OmegaR+sqrt(OmegaR*OmegaR-1)));
fprintf('\n\n ********** Chebyshev-I Filter Order = %3.0f \n', N) % Digital Chebyshev-1 Filter Design:
wn = wp/pi; % Digital Chebyshev-1 cutoff freq in pi units [b, a] = cheby1(N, Rp, wn); [C, B, A] = dir2cas(b, a) % Calculation of Frequency Response:
[db, mag, pha, grd, ww] = freqz_m(b, a); %% -----------------------------------------------------------------
%% Plot
%% ----------------------------------------------------------------- figure('NumberTitle', 'off', 'Name', 'Exameple 8.22')
set(gcf,'Color','white');
M = 1; % Omega max subplot(2,2,1); plot(ww/pi, mag); axis([0, M, 0, 1.2]); grid on;
xlabel(' frequency in \pi units'); ylabel('|H|'); title('Magnitude Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.1778, 0.8913, 1]); subplot(2,2,2); plot(ww/pi, pha/pi); axis([0, M, -1.1, 1.1]); grid on;
xlabel('frequency in \pi nuits'); ylabel('radians in \pi units'); title('Phase Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-1:1:1]); subplot(2,2,3); plot(ww/pi, db); axis([0, M, -30, 10]); grid on;
xlabel('frequency in \pi units'); ylabel('Decibels'); title('Magnitude in dB ');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-30, -15, -1, 0]); subplot(2,2,4); plot(ww/pi, grd); axis([0, M, 0, 15]); grid on;
xlabel('frequency in \pi units'); ylabel('Samples'); title('Group Delay');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0:5:15]);
运行结果:
《DSP using MATLAB》示例Example 8.22的更多相关文章
- 《DSP using MATLAB》Problem 6.22
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 5.22
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% O ...
- 《DSP using MATLAB》 Problem 3.22
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 8.22
时光飞逝,亲朋会一个一个离我们远去,孤独漂泊一阵子后,我们自己也要离开, 代码: %% -------------------------------------------------------- ...
- 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.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.17
随机推荐
- springboot获取配置文件中的内容
代码: GrilApplication.java @SpringBootApplication public class GrilApplication { public static void ma ...
- no crontab for root 解决方案
root用户下 输入 crontab -l 显示 no crontab for root 例如: [root@localhost ~]# crontab -l no crontab for root ...
- linux定时任务php
1. 在需要定时执行的PHP文件的第一行加 #! /usr/local/php/bin/php 服务器php.exe的位置 2. 上传要定时执行的php文件到一个位置,可以通过/pa ...
- WIN10局域网共享,经常出现无法访问的现象的解决方法
WIN10的局域网共享是真操蛋啊,用着好好的,重启了一下,突然就不好用了,其他人无法访问我的电脑,百度了半天也没有找到能解决的访问,文章中说的都试过了,该开启的也都开启了,防火墙也关了,没用,后来想着 ...
- 重新学习MySQL数据库2:『浅入浅出』MySQL 和 InnoDB
重新学习Mysql数据库2:『浅入浅出』MySQL 和 InnoDB 作为一名开发人员,在日常的工作中会难以避免地接触到数据库,无论是基于文件的 sqlite 还是工程上使用非常广泛的 MySQL.P ...
- 12.详解Condition的await和signal等待通知机制
1.Condition简介 任何一个java对象都天然继承于Object类,在线程间实现通信的往往会应用到Object的几个方法,比如wait(),wait(long timeout),wait(lo ...
- python报错:TypeError: 'int' object is not subscriptable
检查一遍报错的所在行,此报错一般是在整数上加了下标: 比如: a = 4 c=a[2] 报错:line 2, in <module> c=a[2] TypeError: 'i ...
- cf 290F. Treeland Tour 最长上升子序列 + 树的回溯 难度:1
F. Treeland Tour time limit per test 5 seconds memory limit per test 256 megabytes input standard in ...
- python文件名不要跟模块名相同,报错AttributeError: 'module' object has no attribute 'Differ'
python中的文件都会生成pyc文件,包括模块也是这样,所以调用模块的时候,实际上会调用模块.pyc文件:在这个前提下,如果将文件名命名成跟模块名一样,在同一目录下就会生成一个跟模块名一样的pyc文 ...
- C#中使用GUID
GUID(全局统一标识符)是指在一台机器上生成的数字,它保证对在同一时空中的所有机器都是唯一的.通常平台会提供生成GUID的API.生成算法很有意思,用到了以太网卡地址.纳秒级时间.芯片ID码和许多可 ...