用到的z变换的计算公式:
代码:
%% ------------------------------------------------------------------------ %% Output Info about this m-file fprintf(' *********************************************************** '); fprintf(' <DSP using MATLAB> Problem 4.1 '); banner(); %% ------------------------------------------------------------------------ %% --------------------------------------------- %% x2(n)=(0.8)^n*u(n-2) %% --------------------------------------------- b = [0, 0, 0.64]; a = [1, -0.8]; % [delta, n] = impseq(0, 0, 7); x2_chk = filter(b, a, delta) x2_ori = (0.8 .^ n) .* stepseq(2, 0, 7) %% --------------------------------------------- %% x3(n)=[0.5^n+(-0.8)^n]u(n) %% --------------------------------------------- b = [2, 0.3]; a = [1, 0.3, -0.4]; % [delta, n] = impseq(0, 0, 7); x3_chk = filter(b, a, delta) x3_ori = (0.5.^n + (-0.8).^ n) .* stepseq(0, 0, 7) %% ---------------------------------------------------- %% x5(n)=[(n+1)3^n]u(n) %% ---------------------------------------------------- b = [1]; a = [1, -6, 9]; % [delta, n] = impseq(0, 0, 7); x5_chk = filter(b, a, delta) [y, ny] = stepseq(0, 0, 7); x5_ori = ( (n+1) .* 3.^n ) .* stepseq(0, 0, 7)
运行结果: