代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Exameple 8.23 \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-2 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-2 Filter Order = %3.0f \n', N) % Digital Chebyshev-2 Filter Design:
wn = ws/pi; % Digital Chebyshev-2 cutoff freq in pi units [b, a] = cheby2(N, As, 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.23')
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.23的更多相关文章

  1. 《DSP using MATLAB》Problem 7.23

    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...

  2. 《DSP using MATLAB》Problem 6.23

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

  3. 《DSP using MATLAB》Problem 4.23

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  4. 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 ...

  5. 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 ...

  6. DSP using MATLAB 示例 Example3.19

    代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Discrete-time Signa ...

  7. DSP using MATLAB示例Example3.18

    代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Continuous-time Fou ...

  8. 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 ...

  9. DSP using MATLAB 示例Example3.17

  10. 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, ...

随机推荐

  1. uva10600次小生成树模板题

    裸题,上模板就行,注意j  !  =  k #include<map> #include<set> #include<cmath> #include<queu ...

  2. 搞懂分布式技术3:初探分布式协调服务zookeeper

    搞懂分布式技术3:初探分布式协调服务zookeeper 1.Zookeepr是什么 Zookeeper是一个典型的分布式数据一致性的解决方案,分布式应用程序可以基于它实现诸如数据发布/订阅,负载均衡, ...

  3. Java 里的异常(Exception)详解

    作为一位初学者, 本屌也没有能力对异常谈得很深入.   只不过Java里关于Exception的东西实在是很多. 所以这篇文章很长就是了.. 一, 什么是java里的异常   由于java是c\c++ ...

  4. 利用PXE引导安装centos7

    # 利用PXE引导安装centos7 # ###简介### > PXE (Pre-boot Execution Environment,PXE client 在网卡的 ROM 中,当计算机引导时 ...

  5. 【问题解决记录】无法识别的标志“-sdlMode”,在“p2”中

    本文为大便一箩筐的原创内容,转载请注明出处,谢谢:http://www.cnblogs.com/dbylk/ 这是本人第一次使用MarkDown编辑器,试试看效果-w-,下面是正文: 一.报错原因 昨 ...

  6. Mutations

    蛤蟆可以吃队友,也可以吃对手. 如果数组第一个字符串元素包含了第二个字符串元素的所有字符,函数返回true. 举例,["hello", "Hello"]应该返回 ...

  7. 基于C#在Mongodb的Skip-Limit和Where-Limit的分页对比 并且含mongodb帮助类的源码

    最近在设计的日志服务中需要用到Mongodb这个Nosql数据库(不知道Mongodb的点我),由于是用于纯存日志,而且日志量巨大,百万千万级的,所以需要用到它的分页查询. 不过LZ也是刚刚接触这个数 ...

  8. Python基础学习----字典常用操作

    字典的常见操作: # 字典: # 格式:{键值对,键值对} dict_demo={"name":"bai-boy","age":17} # ...

  9. L146 Space Station Hole Cause Will Be Determined

    The head of the U.S. space agency said Tuesday he's sure that investigators will determine the cause ...

  10. echarts-detail---饼图

    echarts-饼图 1.饼图上面显示纵坐标的百分比数值 series: [ { name: arr[i].name, type: 'pie', radius: ['30%', '50%'], avo ...