《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 示例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 , ...
随机推荐
- 前端优化点(此文转载 http://mp.weixin.qq.com/s/6mVVKmqDL_xYl15AeoJTWg)
此文转载自:http://mp.weixin.qq.com/s/6mVVKmqDL_xYl15AeoJTWg (原文地址) 围绕前端的性能多如牛毛,涉及到方方面面,以下我们将围绕PC浏览器和移动端浏览 ...
- Eclipse中如何查看使用的JDK版本
有两种方法可以查看eclipse中jdk的版本: 第一种方法: 点击开始--运行--输入cmd--点击确定--在cmd命令行窗口中输入java -version,就可以显示出当前在使用的jdk的版本号 ...
- Labeled Faces in the Wild 人脸识别数据集
http://blog.csdn.net/garfielder007/article/details/51480525 New (draft) survey paper: Labeled Faces ...
- mysql 触发器 trigger用法 one (简单的)
实例~~ example1: 创建表tab1 1 2 3 4 DROP TABLE IF EXISTS tab1; CREATE TABLE tab1( tab1_id varchar(11) ...
- php时间戳函数mktime()
在项目开发中,偶尔会遇到跨周期.跨月的的时间操作.PHP为我们提供了一个很方便的函数->mktime,可以很简单的获取制定日期的时间戳了. mktime(hour,minute,second,m ...
- 2018-2019-1 20189215 《Linux内核原理与分析》第六周作业
<庖丁解牛>第五章书本知识总结 system_call并不是一个普通的函数,只是一段汇编代码的起点,且内部没有严格遵守函数调用堆栈机制. 通过set_system_trap_gate函数绑 ...
- CSS3之嵌入Web字体
之前如果想在自己的网站使用某些好看的字体,总是迫不得已得在PS里先把字体图片做好.虽然这样做也能达到我们想要的效果,但是这样就增加了HTTP请求(如果在多处使用的话),即使合并所有图片,也不好管理,灵 ...
- CCleaner如何禁用开机自动启动
https://forum.piriform.com/topic/42073-ccleaner-starts-on-startup/ 在options-->setting里面选择开机不启动 在O ...
- 比较两个JSON字符串是否完全相等
RT,比较两个JSON字符串是否完全相等,这里使用google贡献的Gson. 一,no POJO,即不另外创建一个简单Java类 [java] view plain copy String str1 ...
- 转:常用svn命令
在公司需要提交代码,常用的就是co.ci.add.up.和log 首先 svn help 可以看到 svn 所支持的全部命令: 命令不多,如果用过Tortoise SVN的客户端,从字面上也不难理解这 ...