首页 > 其他 > 详细

《DSP using MATLAB》示例Example5.15

时间:2016-12-11 10:07:35      阅读:259      评论:0      收藏:0      [点我收藏+]

技术分享

技术分享

 

代码:

x1 = [1,2,2]; x2 = [1,2,3,4]; y1 = circonvt(x1,x2,5);            % N = 5

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

ny1 = 0:1:length(y1)-1;

%% -----------------------------------------------------------------
%%                  START   a
%% -----------------------------------------------------------------
figure(‘NumberTitle‘, ‘off‘, ‘Name‘, ‘Exameple5.15a ‘)
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(ny1,y1); title(‘Circularly convolution sequence y1(n)‘); axis([0,5,0,20]);
xlabel(‘n‘); ylabel(‘y1(n)‘); grid on;


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


y2 = circonvt(x1,x2,6);            % N = 6

ny2 = 0:1:length(y2)-1;

%% -----------------------------------------------------------------
%%                  START   b
%% -----------------------------------------------------------------
figure(‘NumberTitle‘, ‘off‘, ‘Name‘, ‘Exameple5.15b ‘)
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(ny2,y2); title(‘Circularly convolution sequence y2(n)‘); axis([0,5,0,20]);
xlabel(‘n‘); ylabel(‘y2(n)‘); grid on;


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

  结果:

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

 

《DSP using MATLAB》示例Example5.15

原文:http://www.cnblogs.com/ky027wh-sx/p/6159017.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!