首页 > 代码库 > 《DSP using MATLAB》示例Example5.5
《DSP using MATLAB》示例Example5.5
代码:
%% ---------------------------------------------------------- %% 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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。