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

《DSP using MATLAB》示例Example5.9

时间:2016-12-07 07:48:49      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:com   分享   title   end   and   color   nbsp   atl   pre   

技术分享

技术分享

代码:

n = 0:10; x = 10*(0.8) .^ n; y = x(mod_1(-n,11)+1);

%% -----------------------------------------------------------------
%%                  START   a
%% -----------------------------------------------------------------
figure(‘NumberTitle‘, ‘off‘, ‘Name‘, ‘Exameple5.9a x sequence‘)
set(gcf,‘Color‘,‘white‘); 
subplot(2,1,1); stem(n,x); title(‘Original sequence x(n)‘); %axis([0,10,-2.5,2.5]);
xlabel(‘n‘); ylabel(‘x(n)‘); grid on;
subplot(2,1,2); stem(n,y); title(‘Circularly folded sequence y(n)‘); %axis([0,10,-2.5,2.5]);
xlabel(‘n‘); ylabel(‘y(n)=x(-n mod 10)‘); grid on;
%% -----------------------------------------------------------------
%%                  END   a
%% -----------------------------------------------------------------


%% -----------------------------------------------------------------
%%              START   b
%% -----------------------------------------------------------------
X_DFT = dft(x,11);   Y_DFT = dft(y,11);                 % DFT of x and y

realX_DFT = real(X_DFT); imagX_DFT = imag(X_DFT);
realY_DFT = real(Y_DFT); imagY_DFT = imag(Y_DFT);

figure(‘NumberTitle‘, ‘off‘, ‘Name‘, ‘Exameple5.9b x sequence‘)
set(gcf,‘Color‘,‘white‘); 
subplot(2,2,1); stem(n,realX_DFT); title(‘Real {DFT[x(n)]}‘); %axis([0,N,-0.5,1.5]);
xlabel(‘k‘); grid on;
subplot(2,2,2); stem(n,imagX_DFT); title(‘Imag {DFT[x(n)]}‘); %axis([0,N,-0.5,1.5]);
xlabel(‘k‘); grid on;
subplot(2,2,3); stem(n,realY_DFT); title(‘Real {DFT[x((-n))11]}‘); %axis([0,N,-0.5,1.5]);
xlabel(‘k‘); grid on;
subplot(2,2,4); stem(n,imagY_DFT); title(‘Imag {DFT[x((-n))11]}‘); %axis([0,N,-0.5,1.5]);
xlabel(‘k‘); grid on;
%% -----------------------------------------------------------------
%%                    END   b
%% -----------------------------------------------------------------

  运行结果:

技术分享

技术分享

 

《DSP using MATLAB》示例Example5.9

标签:com   分享   title   end   and   color   nbsp   atl   pre   

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

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