《DSP using MATLAB》Problem 2.17

1、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.17 \n\n');
banner();
%% ------------------------------------------------------------------------
nx1 = [0:4]; x1 = [1, 2, 3, 4, 5];
nh1 = [0:3]; h1 = [6, 7, 8, 9];
[y1, ny1] = conv_m(x1, nx1, h1, nh1);
ny1
y1
figure('NumberTitle', 'off', 'Name', 'Problem 2.17')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色
subplot(3,1,1); stem(nx1, x1); title('x1 sequence');
xlabel('n'); ylabel('x(n)') ;
grid on
subplot(3,1,2); stem(nh1, h1); title('h1 sequence');
xlabel('n'); ylabel('h1(n)');
grid on;
subplot(3,1,3); stem(ny1, y1); title('y1=x1*h1 sequence');
xlabel('n'); ylabel('y1(n)');
grid on;
运行结果:


牢记:
1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。

浙公网安备 33010602011771号