《DSP using MATLAB》示例 Example 9.8

时间:2022-09-02 00:00:10

《DSP using MATLAB》示例 Example 9.8

《DSP using MATLAB》示例 Example 9.8

代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Exameple 9.8 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %7s \n\n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ I = 5; Rp = 0.1; As = 30; wp = pi/I; ws = wp+pi*0.12;
[delta1, delta2] = db2delta(Rp, As); weights = [delta2/delta1, 1];
F = [0, wp, ws, pi]/pi; A = [I, I, 0, 0];
h = firpm(30, F, A, weights); n = [0:length(h)-1];
[Hr, w, a, L] = Hr_Type1(h); Hr_min = min(Hr); w_min = find(Hr == Hr_min);
H = abs(freqz(h, 1, w)); Hdb = 20*log10(H/max(H)); min_attn = Hdb(w_min); %% -----------------------------------------------------------------
%% Plot
%% -----------------------------------------------------------------
Hf1 = figure('units', 'inches', 'position', [1, 1, 8, 6], ...
'paperunits', 'inches', 'paperposition', [0, 0, 6, 4], ...
'NumberTitle', 'off', 'Name', 'Exameple 9.8');
set(gcf,'Color','white'); TF = 10; subplot(2, 2, 1);
Hs1 = stem(n, h, 'filled'); set(Hs1, 'markersize', 2);
axis([-1, length(n), -0.5, 1.5]); grid on;
xlabel('n', 'vertical', 'bottom'); ylabel('Amplitude');
title('Impulse Response', 'fontsize', TF); subplot(2, 2, 3);
plot(w/pi, Hr, 'm', 'linewidth', 1.0); axis([0, 1, -1, 6]); grid on;
xlabel('frequency in \pi units', 'fontsize', 10); ylabel('Amplitude');
title(' Amplitude Response ', 'fontsize', TF);
set(gca, 'xtick', [0, wp/pi, ws/pi, 1]);
set(gca, 'ytick', [0, I]); subplot(2, 2, 2);
plot(w/pi, Hdb, 'm', 'linewidth', 1.0); axis([0, 1, -50, 10]); grid on;
xlabel('frequency in \pi units '); ylabel('Decibels');
title('Log-mag Response ', 'fontsize', TF);
set(gca, 'xtick', [0, wp/pi, ws/pi, 1]);
set(gca, 'ytick', [-50, round(min_attn), 0]); subplot(2, 2, 4);
lw = length(w)-1; PB = [0:floor(wp/pi*lw)]; HrPB = Hr(PB+1)-I;
SB = [ceil(ws/pi*lw):lw]; HrSB = Hr(SB+1);
[AX, H1, H2] = plotyy(PB/lw, HrPB, SB/lw, HrSB); delta1 = round(delta1*I*100)/100; delta2 = round(delta2*I*100)/100;
set(AX(1), 'xtick', [0, wp/pi, ws/pi, 1]);
set(AX(1), 'ytick', [-delta1, 0, delta1], 'Ycolor', 'g');
set(AX(2), 'xtick', [0, wp/pi, ws/pi, 1]);
set(AX(2), 'ytick', [-delta2, 0, delta2], 'Ycolor', 'r');
set(H1, 'color', 'g', 'linewidth', 1);
set(H2, 'color', 'r', 'linewidth', 1);
title('scaled ripples', 'fontsize', TF);
xlabel('Frequency in \pi units');

  运行结果:

《DSP using MATLAB》示例 Example 9.8

尽管该滤波器通过了原始信号,如果信号是全频带π弧度的,那么邻近的谱能量可能发生泄漏。因此需要更好的设计指标,本节的后面有讨论。

《DSP using MATLAB》示例 Example 9.8的更多相关文章

  1. DSP using MATLAB 示例Example3&period;21

    代码: % Discrete-time Signal x1(n) % Ts = 0.0002; n = -25:1:25; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*a ...

  2. DSP using MATLAB 示例 Example3&period;19

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

  3. DSP using MATLAB示例Example3&period;18

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

  4. DSP using MATLAB 示例Example3&period;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&period;22

    代码: % Discrete-time Signal x2(n) Ts = 0.001; n = -5:1:5; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*abs(nT ...

  6. DSP using MATLAB 示例Example3&period;17

  7. DSP using MATLAB示例Example3&period;16

    代码: b = [0.0181, 0.0543, 0.0543, 0.0181]; % filter coefficient array b a = [1.0000, -1.7600, 1.1829, ...

  8. DSP using MATLAB 示例 Example3&period;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 ...

  9. DSP using MATLAB 示例 Example3&period;13

    上代码: w = [0:1:500]*pi/500; % freqency between 0 and +pi, [0,pi] axis divided into 501 points. H = ex ...

  10. DSP using MATLAB 示例 Example3&period;12

    用到的性质 代码: n = -5:10; x = sin(pi*n/2); k = -100:100; w = (pi/100)*k; % freqency between -pi and +pi , ...

随机推荐

  1. 在windows中使用VMWare安装Mac OS 10&period;7

    请参考http://www.cnblogs.com/huwlnew/archive/2011/11/15/2250342.html http://unmi.cc/vmware9-install-mac ...

  2. 第1阶段——关于u-boot目标文件start&period;o中&period;globl 和&period;balignl理解&lpar;3&rpar;

    汇编程序中以.开头的名称并不是指令的助记符,不会被翻译成机器指令,而是给汇编器一些特殊指示,称为伪操作. .globl _start 作用:声明一个_start全局符号(Symbol), 这个_sta ...

  3. ARM指令集详解

    一.跳转指令 B: 跳转指令 BL: 带返回的跳转指令 BLX: 带返回和状态切换的跳转指令 BX: 带状态切换的跳转指令 二.数据处理指令 1.MOV:数据传送指令 MOV{条件}{S}    目的 ...

  4. &lbrack;转&rsqb;php模拟post提交请求,调用接口

    本文转自:https://www.cnblogs.com/jiqing9006/p/3949190.html /** * 模拟post进行url请求 * @param string $url * @p ...

  5. 2019 GOALS

    ANNUAL GOAL 生活 1. 养成早睡早起的习惯 2. 体重:43kg 总体来讲希望自己有一个健康的生活方式,良好的饮食.运动习惯. 2019-04-17 18:47:14 UPDATE 3. ...

  6. Mybatis的mapper文件中&dollar;和&num;的用法及区别详解

    https://www.2cto.com/database/201806/752139.html用了一段时间的Mybatis了,对于$和#的用法老是很迷糊,特此记下加深记忆. 简单来说 #{} 会在将 ...

  7. check&lowbar;mk 分布式监控

    http://mathias-kettner.com/checkmk_wato_distributed.html peer(贵族) 管理多个slave 复制配置文件 /etc/check_mk/con ...

  8. (转载)git常用命令

    创建和使用git ssh key 首先设置git的user name和email: git config --global user.name "xxx" git config - ...

  9. POJ2096Collecting Bugs(数学期望,概率DP)

    问题: Ivan is fond of collecting. Unlike other people who collect post stamps, coins or other material ...

  10. linux 第五部分 系统管理员 网络设定与备份

    linux 第五部分 系统管理员   网络设定与备份 系统基本设置   1.网络的设置  手动设置与dhcp自动获得     以及更改主机名称 centos 7   对网卡编号的规则 enol1  b ...