《DSP using MATLAB》示例Example 9.7
代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Exameple 9.7 \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 = 4; L = 5;
%n = 0:2048; k1 = 256; k2 = k1+32; m = 0:(k2-k1); %% -----------------------------------------------------------------
%% Plot
%% -----------------------------------------------------------------
Hf1 = figure('units', 'inches', 'position', [1, 1, 8, 6], ...
'paperunits', 'inches', 'paperposition', [0, 0, 6, 4], ...
'NumberTitle', 'off', 'Name', 'Exameple 9.7');
set(gcf,'Color','white'); TF = 10;
% (a) Full singal bandwidth: alpha = 1
I
L
alpha = 1; h = intfilt(I, L, alpha);
fprintf('\n The Length of filter is %d \n', length(h) ); [Hr, w, a, LL] = 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); subplot(2, 2, 1);
plot(w/pi, Hr, 'g', 'linewidth', 1.0); axis([0, 1, -1, 5]); grid on;
xlabel('frequency in \pi units'); ylabel('Amplitude');
title('Amplitude Response:alpha = 1 ', 'fontsize', TF);
set(gca, 'xtick', [0, 1/I, 1]);
set(gca, 'ytick', [0, I]); subplot(2, 2, 3);
plot(w/pi, Hdb, 'm', 'linewidth', 1.0); axis([0, 1, -50, 10]); grid on;
xlabel('frequency in \pi units', 'fontsize', 10); ylabel('Decibels');
title(' Log-mag Response : alpha = 1 ', 'fontsize', TF);
set(gca, 'xtick', [0, 1/I, 1]);
set(gca, 'ytick', [-50, round(min_attn), 0]); % (b) Partial signal bandwidth: alpha = 0.75
I
L
alpha = 0.75; h = intfilt(I, L, alpha); fprintf('\n The Length of filter is %d \n', length(h) ); [Hr, w, a, LL] = Hr_Type1(h); Hr_min = max(Hr(end/2:end)); w_min = find(Hr == Hr_min);
H = abs(freqz(h, 1, w)); Hdb = 20*log10(H/max(H)); min_attn = Hdb(w_min); subplot(2, 2, 2);
plot(w/pi, Hr, 'g', 'linewidth', 1.0); axis([0, 1, -1, 5]); grid on;
xlabel('frequency in \pi units '); ylabel('Amplitude');
title('Amplitude Response : alpha = 0.75 ', 'fontsize', TF);
set(gca, 'xtick', [0, 1/I, 1]);
set(gca, 'ytick', [ 0, I]); subplot(2, 2, 4); 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: alpha = 0.75', 'fontsize', TF);
set(gca, 'xtick', [0, 1/I, 1]);
set(gca, 'ytick', [-50, round(min_attn), 0]);
运行结果:
可见,两种α情况下,intfilt函数得到的脉冲响应h长度为2×I×L-1=2×4×5-1=39,即数组h(n)有39个元素。
对于全频带alpha=1的情况,滤波器在通带和阻带都有更多的振荡,最小的阻带衰减是22dB。这是由过渡带很窄造成的。
当alpha=0.75时,滤波器特征是很宽容的,因此它的响应最小阻带衰减34dB。
另外注意到我们没有完全控制其他设计参数。这些细节本节随后会有更详细的讨论。
《DSP using MATLAB》示例Example 9.7的更多相关文章
- 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.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.17
- 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, ...
- DSP using MATLAB 示例 Example3.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 ...
- DSP using MATLAB 示例 Example3.13
上代码: w = [0:1:500]*pi/500; % freqency between 0 and +pi, [0,pi] axis divided into 501 points. H = ex ...
- 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 , ...
随机推荐
- Flutter新手第一个坑:Could not find com.android.tools.lint:lint-gradle:26.1.1.
解决方法1:修改build.gradle,注释掉jcenter(),google().使用阿里的镜像.原因是jcenter google库无法访问到导致的问题.虽然我有万能的爬墙工具,开启全局代理依然 ...
- authentication vs authorization 验证与授权的区别
认证和授权的区别 Authentication vs. Authorization简单来说,认证(Authentication )是用来回答以下问题: 用户是谁 当前用户是否真的是他所代表的角色 通常 ...
- 13.LockSupport工具
1. LockSupport简介 在之前介绍AQS的底层实现,已经在介绍java中的Lock时,比如ReentrantLock,ReentReadWriteLocks,已经在介绍线程间等待/通知机制使 ...
- [Android]如何减小APK的大小
能不引用的外部包就不用,删除没用的图片.xml,优化代码去掉没用的部分,能异步下载的资源就运行时从网络上下载.
- Java进阶7并发优化4——JDK并发数据结构
Java进阶7并发优化4——JDK并发数据结构20131114 由于并发程序和串行程序的不同特点,在串行程序中使用的数据结构可能无法在并行程序中直接的正常使用,因为这些数据结构可能不是线程安全的,所以 ...
- c# 使用SqlBulkCopy 提高大数据插入数据库速度
自己得一点总结: 1.BulkCopy采用的是插入方式,不是覆盖方式(原数据不动,在原数据的后面复制上dataTable中的内容) 2.自增的字段不用赋值 3.数据库字段名和dataTable列名可以 ...
- SQL 按照多个字段为标准的重复数据处理
表结构:T1 id int Uncheckedname nchar(10) Checkedvalue nchar(10) Checked 数据: 1 a a1 2 a a1 3 b b1 4 b b2 ...
- CF445
题解: xjb乱判断一下就可以了 代码: #include<bits/stdc++.h> using namespace std; typedef long long ll; int n, ...
- qml自定义带文字的button tabbutton
https://blog.csdn.net/u014416260/article/details/54579480
- iOS跳转支付宝付款码和扫一扫页面
iOS跳转支付宝付款码和扫一扫页面 // 是否支持支付宝 NSURL * myURL_APP_A = [NSURL URLWithString:@"alipay://"]; if ...