首页 > 代码库 > 《DSP using MATLAB》示例Example5.19

《DSP using MATLAB》示例Example5.19

技术分享

代码:

n = 0:9; x = n+1; h = [1,0,-1]; N = 6; y = ovrlpsav(x,h,N);

nh = 0:1:length(h)-1;
ny = 0:1:length(y)-1;
%% -----------------------------------------------------------------
%%                  START   a
%% -----------------------------------------------------------------
figure(‘NumberTitle‘, ‘off‘, ‘Name‘, ‘Exameple5.19 ‘)
set(gcf,‘Color‘,‘white‘); 
subplot(3,1,1); stem(n,x); title(‘sequence x(n)‘); %axis([0,5,0,5]);
xlabel(‘n‘); ylabel(‘x(n)‘); grid on;
subplot(3,1,2); stem(nh,h); title(‘impulse sequence h(n)‘); %axis([0,5,0,5]);
xlabel(‘n‘); ylabel(‘h(n)‘); grid on;
subplot(3,1,3); stem(ny,y); title(‘Linear Convolution sequence x3(n)‘); %axis([0,10,-3,5]);
xlabel(‘n‘); ylabel(‘y(n)‘); grid on;

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

  运行结果:

技术分享

技术分享

 

《DSP using MATLAB》示例Example5.19