《DSP using MATLAB》示例Example5.2
代码:
L = 5; N = 20; k = [-N/2:N/2]; % square wave parameters
xn = [ones(1,L), zeros(1,N-L)]; % Sq wave x(n)
Xk = dfs(xn,N); % DFS %% ----------------------------------------------------
%% START periodic sequence
%% ----------------------------------------------------
self_periods = N;
periods = 3;
n1 = [-20: -1 + (periods-1) * self_periods]; xtilde = xn' * ones(1,periods); xtilde = (xtilde(:))'; figure('NumberTitle', 'off', 'Name', 'Example5.2 3 Period Sequence')
set(gcf,'Color','white');
stem(n1,xtilde); title('Three Peroids of xtilde(n)');axis([-20, 40, -0.5, 1.5]);
xlabel('n'); ylabel('xtilde(n)');grid on;
%% ----------------------------------------------------
%% END periodic sequence
%% ---------------------------------------------------- magXk = abs([Xk(N/2+1:N) Xk(1:N/2+1)]); % DFS magnitude figure('NumberTitle', 'off', 'Name', 'Example5.2')
set(gcf,'Color','white');
subplot(2,2,1); stem(k, magXk); axis([-N/2, N/2, -0.5, 5.5]);
xlabel('k'); ylabel('Xtilde(k)'); grid on;
title('DFS of SQ. wave: L=5 N=20'); L = 5; N = 40; k = [-N/2:N/2]; % square wave parameters
xn = [ones(1,L), zeros(1,N-L)]; % Sq wave x(n)
Xk = dfs(xn,N); % DFS magXk = abs([Xk(N/2+1:N) Xk(1:N/2+1)]); % DFS magnitude %figure('NumberTitle', 'off', 'Name', 'Example5.2')
%set(gcf,'Color','white');
subplot(2,2,2); stem(k, magXk); axis([-N/2, N/2, -0.5, 5.5]);
xlabel('k'); ylabel('Xtilde(k)'); grid on;
title('DFS of SQ. wave: L=5 N=40'); L = 5; N = 60; k = [-N/2:N/2]; % square wave parameters
xn = [ones(1,L), zeros(1,N-L)]; % Sq wave x(n)
Xk = dfs(xn,N); % DFS magXk = abs([Xk(N/2+1:N) Xk(1:N/2+1)]); % DFS magnitude %figure('NumberTitle', 'off', 'Name', 'Example5.2')
%set(gcf,'Color','white');
subplot(2,2,3); stem(k, magXk); axis([-N/2, N/2, -0.5, 5.5]);
xlabel('k'); ylabel('Xtilde(k)'); grid on;
title('DFS of SQ. wave: L=5 N=60'); L = 7; N = 60; k = [-N/2:N/2]; % square wave parameters
xn = [ones(1,L), zeros(1,N-L)]; % Sq wave x(n)
Xk = dfs(xn,N); % DFS magXk = abs([Xk(N/2+1:N) Xk(1:N/2+1)]); % DFS magnitude %figure('NumberTitle', 'off', 'Name', 'Example5.2')
%set(gcf,'Color','white');
subplot(2,2,4); stem(k, magXk); axis([-N/2, N/2, -0.5, 7.5]);
xlabel('k'); ylabel('Xtilde(k)'); grid on;
title('DFS of SQ. wave: L=7 N=60');
运行结果:
《DSP using MATLAB》示例Example5.2的更多相关文章
- 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 , ...
随机推荐
- 【C语言】pragma
① #pragma comment (lib, "libgsl.a") 这是告诉编译器在编译形成的.obj文件和.exe文件中加一条信息,使得 链接器在链接库的时候要去找libgs ...
- NEFU 84 五指山 (扩展欧几里得)
五指山 Problem:84 Time Limit:1000ms Memory Limit:65536K Description 西游记中孙吾空大闹天宫,如来佛祖前来降伏他,说道:"我与你打 ...
- NEFU 504 new Flip Game (高斯消元)
题目链接 题解:和 poj1753Filp game 差不多,区别在于t组数据并且翻转的时候多了一个左上角. #include <iostream> #include <cstdio ...
- 【Excel 4.0 函数】REGISTER 的两种形式以及VBA等效语句
形式1 REGISTER("SAMPLE.DLL", "MyFunction", "AIC") 形式1等效 VBA语句 Declare Fu ...
- WAMP2.5 Forbidden
Forbidden You don't have permission to access /DuoLamPHP/index.php on this server. Apache/2.4.9 (Win ...
- October 1st 2016 Week 40th Saturday
Autumn, the year's last, loveliest smile. 秋,四季流转中的最后一抹,也是最美的那一抹微笑. I love autumn because it is the h ...
- Mysql相关集锦
1.MyBatis中设置或获取插入的自增主键 http://my.oschina.net/kolbe/blog/512904 2.MySql性能调优与架构设计系列 http://www.cnblogs ...
- 在DB2 for z/os上创建指定pagesize的数据库
ASNTDIFF的diff table有一列类型为varchar 15000,z上创建db默认的pagesize是4K,无法创建table,所以需要创建一个大pagesize的database. db ...
- NYOJ题目96 n-1位数
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAscAAAJgCAIAAADpjVkvAAAgAElEQVR4nO3du04jS/gv7H0T5FwIsa ...
- NYOJ题目74小学生算术
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAsYAAAI0CAIAAACRUHjwAAAgAElEQVR4nO3dO3LbyroG0DsJ5RqIYg