《DSP using MATLAB》示例Example 8.4
代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Exameple 8.4 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %9s \n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ Wp = 0.2*pi; Ws = 0.3*pi; Rp = 7; As =16; Ripple = 10 ^ (-Rp/20); Attn = 10 ^ (-As/20); % Analog filter design:
[b, a] = afd_butt(Wp, Ws, Rp, As); % Calculation of second-order sections:
[C, B, A] = sdir2cas(b, a) % Calculation of Frequency Response:
[db, mag, pha, ww] = freqs_m(b, a, 0.5*pi); % Calculation of Impulse Response:
[ha, x, t] = impulse(b, a); %% -------------------------------------------------
%% Plot
%% ------------------------------------------------- figure('NumberTitle', 'off', 'Name', 'Exameple 8.4')
set(gcf,'Color','white');
M = 0.5; % Omega max subplot(2,2,1); plot(ww/pi, mag); axis([0, M, 0, 1.2]); grid on;
xlabel(' Analog 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.1585, 0.4467, 1]); subplot(2,2,2); plot(ww/pi, db); axis([0, M, -30, 10]); grid on;
xlabel('Analog 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, -16, -7, 0]); subplot(2,2,3); plot(ww/pi, pha/pi); axis([0, M, -1.1, 1.1]); grid on;
xlabel('Analog frequency in \pi nuits'); ylabel('radians'); title('Phase Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-1:0.5:1]); subplot(2,2,4); plot(t, ha); axis([0, 30, -0.05, 0.25]); grid on;
xlabel('time in seconds'); ylabel('ha(t)'); title('Impulse Response');
运行结果:
《DSP using MATLAB》示例Example 8.4的更多相关文章
- 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 , ...
随机推荐
- flask学习(七):URL反转
1. 什么叫反转URL:从视图函数到url的转换叫做反转url 2. 反转url的用处: 1) 在页面重定向的时候,会使用url反转 2) 在模板中,也会使用url反转 3. 实例: 打印出了url
- Tracing on Linux
The Linux tracing APIs are a relatively new addition to the kernel and one of the most powerful new ...
- springmvc日期格式化
jsp页面String类型转Controller后台Date类型 方法1.在实体中加入日期格式化注解 @DateTimeFormat(pattern="yyyy-MM-dd") p ...
- cf 915
t1:2分钟ac,简单模拟 t2:3发wa,最后再10分钟的时候过了 但是最后被hack了 t3:2发wa,最后还是被hack了 t4:拓扑排序 然后将一个点入度减一 然后是否能拓扑 t5:离散化+线 ...
- 关于px em rem的一点小总结
2015-11-28 06:06:40 概念 都是CSS单位. px:像素 Pixel.像素 (计算机屏幕上的一个点) em:1em 等于当前的字体尺寸. 2em 等于当前字体尺寸的两倍. 例如,如果 ...
- 【前端安全】 web前端安全编码(模版篇)【转】
在web的开发的开发过程中,前端总是在处理后端打的各种变量,变量可以包含着中的各种各样的字符,如果不对这些字符进行”特殊“处理的话,轻者导 致页面不正常的显示,潜入了其他的东西,亦即页面挂了,或者弹出 ...
- 解决chrome报Not allowed to load local resource错误的方法
最近项目中遇到了关于图片的更改->保存->本地读取 在本地读取的环节上面出现了错误,一开始用的是直接本地路径,但是在页面上调试的出现了下面的错误,他的路径还是相对路径,下图所示: Goog ...
- L148
You don't know about real loss, because that only occurs when you love something more than you love ...
- Linux:history命令详解
Linux下History命令 主要用于显示历史指令记录内容, 下达历史纪录中的指令 . 语法 history [n] history [-c] history [-raw] histfiles ...
- socket函数sendto与send的区别
C:socket相关的sendto()函数简介 http://blog.csdn.net/flytiger_ouc/article/details/19634279 文中提到SOCK_DGRAM, S ...