《DSP using MATLAB》示例Example 8.12
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Exameple 8.12 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %9s \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 = wp/T; % prototype passband freq
OmegaS = ws/T; % prototype stopband freq % Analog Chebyshev-1 Prototype Filter Calculation:
[cs, ds] = afd_chb1(OmegaP, OmegaS, Rp, As); % Impulse Invariance Transformation:
[b, a] = imp_invr(cs, ds, T); [C, B, A] = dir2par(b, a) % Calculation of Frequency Response:
[db, mag, pha, grd, ww] = freqz_m(b, a); %% -----------------------------------------------------------------
%% Plot
%% ----------------------------------------------------------------- figure('NumberTitle', 'off', 'Name', 'Exameple 8.12')
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.12的更多相关文章
- 《DSP using MATLAB》Problem 7.12
阻带衰减50dB,我们选Hamming窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 6.12
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 5.12
1.从别的地方找的证明过程: 2.代码 function x2 = circfold(x1, N) %% Circular folding using DFT %% ----------------- ...
- 《DSP using MATLAB》Problem 8.12
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 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 , ...
- DSP using MATLAB 示例Example2.12
代码: b = [1]; a = [1, -0.9]; n = [-5:50]; h = impz(b,a,n); set(gcf,'Color','white'); %subplot(2,1,1); ...
- 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.11
用到的性质 上代码: n = -5:10; x = rand(1,length(n)); k = -100:100; w = (pi/100)*k; % freqency between -pi an ...
随机推荐
- class文件直接修改_反编译修改class文件变量
今天笔者同事遇到一个问题,客户同事的数据库连接信息直接写在代码中,连接的密码改了,但是又没有源代码,所以只能直接修改Java class文件. 记录一下修改步骤: 1.下载JClassLib_wind ...
- Android自定义圆形ProgressBar
闲来无事做了一个自定义的进度条,大致效果图如下: progressbar.gif 废话不多说,下面直接上代码: 自定义控件代码CircleProgressBar.java: public class ...
- Linux shell常用命令
1. sz 和 rz sz命令发送文件到本地: # sz filename rz命令本地上传文件到服务器: # rz 执行该命令后,在弹出框中选择要上传的文件即可.
- Swift 4.1 正式发布,新增更多泛型特性支持
Swift 4.1 兼容 4.0,并做了一些改进,其中大部分通过了 Swift Evolution 流程.此次发布,包含了对核心语言的更新,包括新增更多对泛型的支持.新的构建选项,以及对 Swift ...
- LabVIEW之安装队列工具包AMC安装问题解决
LabVIEW之安装队列工具包AMC安装问题解决--VIPM无法连接LabVIEW 彭会锋 参考资料: http://www.labviewpro.net/forum_post_detail.php? ...
- CUDA JPEG编码
基于英伟达的jpegNPP工程,分离实现独立的JPEG压缩. 由于原工程是直接把解码时的jpeg图片的信息直接作为编码时的信息,所以在做独立的JPEG编码时,需要自己来填充各种信息. 1.JPEG编码 ...
- oracle11g客户端如何完全卸载(转)
1.停用Oracle服务:进入计算机管理,在服务中,找到oracle开头的所有服务,右击选择停止 2.在开始菜单中,找到Universal Installer,运行Oracle Universal I ...
- yii控制布局方式
1:在控制器内成员变量设置 public $layout = false; //不使用布局 public $layout = “main”; //设置使用的布局文件 2:在控制器成员方法内设置 $th ...
- poj2400
题解: 最少平均分值是等于最佳匹配的权值和除上一个总的点数2*n 注意输入反过来 代码: #include<cstdio> #include<cstring> #include ...
- PHP Socket(套接字连接)扩展简介和使用方法
PHP socket扩展是基于流行的BSD sockets,实现了和socket通讯功能的底层接口,它可以和客户端一样当做一个socket服务器. 使用这些函数时请注意,虽然他们中有很多和C函数同名的 ...