《DSP using MATLAB》 Problem 4.9

FQuantStudio 2018-02-12

《DSP using MATLAB》 Problem 4.9

代码:

%% ----------------------------------------------------------------------------
%%            Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf('        <DSP using MATLAB> Problem 4.9 \n\n');

banner();
%% ----------------------------------------------------------------------------


%% -------------------------------------------------
%%            1      X(z)
%% -------------------------------------------------

b1 = [1, -2, 3, -4]; nb1 = [0:3]; a1 = [4, 3, -2, 1]; na1 = [0:3];               %  

[x1, nx1] = conv_m(b1, nb1, a1, na1)


figure('NumberTitle', 'off', 'Name', 'Problem 4.9.1 X1(z)')
set(gcf,'Color','white'); 
stem(nx1, x1);
title('X1'); grid on;


%% -------------------------------------------------
%%            2      X(z)
%% -------------------------------------------------
b2 = [1, -2, 3, 2, 1]; nb2 = [-2:2]; a2 = [1, 0, 0, 0, 0, 0, -1]; na2 = [-3:3];               %  

[x2, nx2] = conv_m(b2, nb2, a2, na2)


figure('NumberTitle', 'off', 'Name', 'Problem 4.9.2 X2(z)')
set(gcf,'Color','white'); 
stem(nx2, x2);
title('X2'); grid on;


%% -------------------------------------------------
%%            3      X(z)
%% -------------------------------------------------
b3 = [1, 1, 1]; nb3 = [0:2];                %  

[x3_1, nx3_1] = conv_m(b3, nb3, b3, nb3);
[x3, nx3] = conv_m(x3_1, nx3_1, b3, nb3)
figure('NumberTitle', 'off', 'Name', 'Problem 4.9.3 X3(z)')
set(gcf,'Color','white'); 
stem(nx3, x3);
title('X3'); grid on;

%% -------------------------------------------------
%%            4      X4(z)=X1(z)X2(z)+X3(z)
%% -------------------------------------------------
[x4_1, nx4_1] = conv_m(x1, nx1, x2, nx2);
[x4, nx4] = sigadd(x4_1, nx4_1, x3, nx3)
figure('NumberTitle', 'off', 'Name', 'Problem 4.9.4 X4(z)')
set(gcf,'Color','white'); 
stem(nx4, x4);
title('X4'); grid on;

%% -------------------------------------------------
%%            5      X(z)
%% -------------------------------------------------
b5 = [1, 0, -3, 0, 2, 0, 5, 0, -1]; nb5 = [1:9]; 

a5 = [4, 2, 3, 1]; na5 = [-4:-1];               %  

[x5, nx5] = conv_m(b5, nb5, a5, na5)
figure('NumberTitle', 'off', 'Name', 'Problem 4.9.5 X5(z)')
set(gcf,'Color','white'); 
stem(nx5, x5);
title('X5'); grid on;

运行结果:

《DSP using MATLAB》 Problem 4.9《DSP using MATLAB》 Problem 4.9《DSP using MATLAB》 Problem 4.9《DSP using MATLAB》 Problem 4.9《DSP using MATLAB》 Problem 4.9《DSP using MATLAB》 Problem 4.9《DSP using MATLAB》 Problem 4.9

相关推荐