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

《DSP using MATLAB》示例Example5.16

时间:2016-12-12 07:42:59      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:log   rcu   tar   示例   matlab   hit   end   技术   start   

技术分享

 

 

代码:

x1 = [1,2,2,1]; x2 = [1,-1,-1,1]; 
x3 = conv(x1,x2);             % N = 5

n1 = 0:1:length(x1)-1;
n2 = 0:1:length(x2)-1;

n3 = 0:1:length(x3)-1;

%% -----------------------------------------------------------------
%%                  START   a
%% -----------------------------------------------------------------
figure(‘NumberTitle‘, ‘off‘, ‘Name‘, ‘Exameple5.16a ‘)
set(gcf,‘Color‘,‘white‘); 
subplot(3,1,1); stem(n1,x1); title(‘sequence x1(n)‘); axis([0,5,0,5]);
xlabel(‘n‘); ylabel(‘x1(n)‘); grid on;
subplot(3,1,2); stem(n2,x2); title(‘sequence x2(n)‘); axis([0,5,0,5]);
xlabel(‘n‘); ylabel(‘x2(n)‘); grid on;
subplot(3,1,3); stem(n3,x3); title(‘Linear Convolution sequence x3(n)‘); axis([0,10,-3,5]);
xlabel(‘n‘); ylabel(‘x3(n)‘); grid on;


%% -----------------------------------------------------------------
%%                  END   a
%% -----------------------------------------------------------------


x4 = circonvt(x1,x2,7);            % N = 7

n4 = 0:1:length(x4)-1;

%% -----------------------------------------------------------------
%%                  START   b
%% -----------------------------------------------------------------
figure(‘NumberTitle‘, ‘off‘, ‘Name‘, ‘Exameple5.16b ‘)
set(gcf,‘Color‘,‘white‘); 
subplot(3,1,1); stem(n1,x1); title(‘sequence x1(n)‘); axis([0,5,0,5]);
xlabel(‘n‘); ylabel(‘x1(n)‘); grid on;
subplot(3,1,2); stem(n2,x2); title(‘sequence x2(n)‘); axis([0,5,0,5]);
xlabel(‘n‘); ylabel(‘x2(n)‘); grid on;
subplot(3,1,3); stem(n4,x4); title(‘Circularly convolution sequence x4(n)‘); axis([0,10,-3,5]);
xlabel(‘n‘); ylabel(‘x4(n)‘); grid on;


%% -----------------------------------------------------------------
%%                  END   b
%% -----------------------------------------------------------------

  运行结果:

技术分享

技术分享

技术分享

 

《DSP using MATLAB》示例Example5.16

标签:log   rcu   tar   示例   matlab   hit   end   技术   start   

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

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