博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
《DSP using MATLAB》示例Example 8.18
阅读量:4462 次
发布时间:2019-06-08

本文共 2634 字,大约阅读时间需要 8 分钟。

代码:

%% ------------------------------------------------------------------------%%            Output Info about this m-filefprintf('\n***********************************************************\n');fprintf('        
Exameple 8.18 \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 radws = 0.3*pi; % digital stopband freq in radRp = 1; % passband ripple in dBAs = 15; % stopband attenuation in dB% Analog prototype specifications: Inverse Mapping for frequenciesT = 1; Fs = 1/T; % set T = 1OmegaP = (2/T)*tan(wp/2); % Prewarp(Cutoff) prototype passband freqOmegaS = (2/T)*tan(ws/2); % Prewarp(cutoff) prototype stopband freq% Analog Chebyshev-1 Prototype Filter Calculation:[cs, ds] = afd_chb1(OmegaP, OmegaS, Rp, As);% Bilinear Transformation:[b, a] = bilinear(cs, ds, T); [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.18')set(gcf,'Color','white'); M = 1; % Omega maxsubplot(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]);

  运行结果:

转载于:https://www.cnblogs.com/ky027wh-sx/p/6717770.html

你可能感兴趣的文章
easyui时的时间格式yyyy-MM-dd与yyyy-MM-ddd HH:mm:ss
查看>>
专题:动态内存分配----基础概念篇
查看>>
Codeforces Round #426 (Div. 2) (A B C)
查看>>
The Most Simple Introduction to Hypothesis Testing
查看>>
UVA10791
查看>>
P2664 树上游戏
查看>>
jQuery 停止动画
查看>>
Sharepoint Solution Gallery Active Solution时激活按钮灰色不可用的解决方法
查看>>
教你50招提升ASP.NET性能(二十二):利用.NET 4.5异步结构
查看>>
lua连续随机数
查看>>
checkstyle使用介绍
查看>>
会了这十种Python优雅的写法,让你工作效率翻十倍,一人顶十人用!
查看>>
二维码图片生成
查看>>
在做操作系统实验的一些疑问
查看>>
Log4J日志配置详解
查看>>
NameNode 与 SecondaryNameNode 的工作机制
查看>>
Code obfuscation
查看>>
大厂资深面试官 带你破解Android高级面试
查看>>
node.js系列(实例):原生node.js实现接收前台post请求提交数据
查看>>
SignalR主动通知订阅者示例
查看>>