《DSP using MATLAB》Problem 4.18
代码:
%% ------------------------------------------------------------------------ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> Problem 4.18 \n\n'); banner(); %% ------------------------------------------------------------------------ % --------------------------------------- % 1 H1(z) % --------------------------------------- b = 1/4*[1, 2, 0, 1]; a = [1]; % [R, p, C] = residuez(b,a) Mp = (abs(p))' Ap = (angle(p))'/pi %% ---------------------------------------------- %% START a determine H(z) and sketch %% ---------------------------------------------- figure('NumberTitle', 'off', 'Name', 'P4.18.1 H(z) its pole-zero plot') set(gcf,'Color','white'); zplane(b,a); title('pole-zero plot'); grid on; %% ---------------------------------------------- %% END %% ---------------------------------------------- % ------------------------------------ % y1(n) Output % ------------------------------------ yb1 = conv(b, [2]); ya1 = conv(a, [1,-0.9]); [R1, p1, C1] = residuez(yb1, ya1) Mp = (abs(p1))' Ap = (angle(p1))'/pi [delta, n] = impseq(0, 0, 7); y1_check = filter(yb1, ya1, delta) % check sequence y1_answer = -1.7970*impseq(0,0,7) - 0.6173*impseq(1,0,7) - 0.5556*impseq(2,0,7) + 2.2970*(0.9).^n .* stepseq(0,0,7) % answer sequence
运行结果:
只做第1小题了,后面的多少有些出入之处,以后有机会补上。
牢记:
1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。