码迷,mamicode.com
首页 > 其他好文 > 详细

《DSP using MATLAB》示例Example5.5

时间:2016-12-04 09:34:47      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:ges   amp   eal   example   dsp   start   highlight   示例   dfs   

技术分享

代码:

%% ----------------------------------------------------------
%%             START   N=5
%% ----------------------------------------------------------
N = 5; k = 0:1:N-1;                             % sample index
wk = 2*pi*k/N; zk = exp(j*wk);                  % samples of z
Xk = (zk)./(zk-0.7);                            % DFS as samples of X(z)
xn = real(idfs(Xk,N));                          % IDFS
xtilde = xn‘*ones(1,8); xtilde = (xtilde(:))‘;  % Periodic sequence

figure(‘NumberTitle‘, ‘off‘, ‘Name‘, ‘Example5.5‘)
set(gcf,‘Color‘,‘white‘); 
subplot(2,2,1); stem(0:39, xtilde); axis([0, 40, -0.1, 1.5]);
xlabel(‘n‘); ylabel(‘xtilde(n)‘); grid on;
title(‘N=5‘);
%% -----------------------------------------------------------
%%             END    N=5
%% -----------------------------------------------------------


%% ----------------------------------------------------------
%%             START   N=10
%% ----------------------------------------------------------
N = 10; k = 0:1:N-1;                            % sample index
wk = 2*pi*k/N; zk = exp(j*wk);                  % samples of z
Xk = (zk)./(zk-0.7);                            % DFS as samples of X(z)
xn = real(idfs(Xk,N));                          % IDFS
xtilde = xn‘*ones(1,4); xtilde = (xtilde(:))‘;  % Periodic sequence

subplot(2,2,2); stem(0:39, xtilde); axis([0, 40, -0.1, 1.5]);
xlabel(‘n‘); ylabel(‘xtilde(n)‘); grid on;
title(‘N=10‘);
%% ----------------------------------------------------------
%%             END   N=10
%% ----------------------------------------------------------


%% ----------------------------------------------------------
%%             START   N=20
%% ----------------------------------------------------------
N = 20; k = 0:1:N-1;                            % sample index
wk = 2*pi*k/N; zk = exp(j*wk);                  % samples of z
Xk = (zk)./(zk-0.7);                            % DFS as samples of X(z)
xn = real(idfs(Xk,N));                          % IDFS
xtilde = xn‘*ones(1,2); xtilde = (xtilde(:))‘;  % Periodic sequence

subplot(2,2,3); stem(0:39, xtilde); axis([0, 40, -0.1, 1.5]);
xlabel(‘n‘); ylabel(‘xtilde(n)‘); grid on;
title(‘N=20‘);
%% ----------------------------------------------------------
%%             END   N=20
%% ----------------------------------------------------------


%% ----------------------------------------------------------
%%             START   N=40
%% ----------------------------------------------------------
N = 40; k = 0:1:N-1;                            % sample index
wk = 2*pi*k/N; zk = exp(j*wk);                  % samples of z
Xk = (zk)./(zk-0.7);                            % DFS as samples of X(z)
xn = real(idfs(Xk,N));                          % IDFS
xtilde = xn‘*ones(1,1); xtilde = (xtilde(:))‘;  % Periodic sequence

subplot(2,2,4); stem(0:39, xtilde); axis([0, 40, -0.1, 1.5]);
xlabel(‘n‘); ylabel(‘xtilde(n)‘); grid on;
title(‘N=40‘);
%% ----------------------------------------------------------
%%             END   N=40
%% ----------------------------------------------------------

  运行结果:

技术分享

 

《DSP using MATLAB》示例Example5.5

标签:ges   amp   eal   example   dsp   start   highlight   示例   dfs   

原文地址:http://www.cnblogs.com/ky027wh-sx/p/6130205.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!