《DSP using MATLAB》Problem 6.11

代码:

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

banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
b = [0.051   0.088  0.060   -0.029  -0.0690   -0.046];  nb = [0:5];
a = [1.000  -1.340  1.478   -0.789   0.2320];           na = [0:4];

format short;
fprintf(‘\nConvert DIRECT-form to PARALLEL-form :     \n‘);
[C, Bp, Ap] = dir2par(b, a)
%C = 0;

fprintf(‘\nConvert DIRECT-form to CASCADE-form :     \n‘);
[b0, Bc, Ac] = dir2cas(b, a) 

fprintf(‘\nConvert TF-form to SOS-form :     \n‘);
[sos, g] = tf2sos(b, a)

fprintf(‘\nConvert DIRECT-form to LATTICE-LADDER-form :     \n‘);
[P, R] = deconv(b, a)
[p, np, r, nr] = deconv_m(b, nb, a, na)
[Klr, Clr] = dir2ladr(R, a) 

fprintf(‘\nConvert DIRECT-form to MATLAB LATTICE-LADDER-form :     \n‘);
[K, V] = tf2latc(R, a)

% -----------------------------------------
%     START check
% -----------------------------------------
n = [0:7];
delta = impseq(0, 0, 7)
%format long
format  short
hcas = casfiltr(b0, Bc, Ac, delta)

hpar = parfiltr(C, Bp, Ap, delta)

hladr = ladrfilt(Klr, Clr, delta)

hdir = filter(b, a, delta)
% -------------------------------------------
%       END check
% -------------------------------------------

figure(‘NumberTitle‘, ‘off‘, ‘Name‘, ‘P6.11 hcas(n), hpar(n)‘)
set(gcf,‘Color‘,‘white‘);
subplot(2,1,1); stem(n, hcas);
xlabel(‘n‘); ylabel(‘hcas(n)‘);
title(‘hcas(n)‘);  grid on;
subplot(2,1,2); stem(n, hpar);
xlabel(‘n‘); ylabel(‘hpar(n)‘);
title(‘hpar(n)‘);  grid on;

figure(‘NumberTitle‘, ‘off‘, ‘Name‘, ‘P6.11 hladr(n) hdir(n)‘)
set(gcf,‘Color‘,‘white‘);
subplot(2,1,1); stem(n, hladr);
xlabel(‘n‘); ylabel(‘hladr(n)‘);
title(‘hladr(n)‘);  grid on;
subplot(2,1,2); stem(n, hdir);
xlabel(‘n‘); ylabel(‘hdir(n)‘);
title(‘hdir(n)‘);  grid on;

  运行结果:

这里只放并联形式系数的图,其它形式系数不附图了。

原文地址:https://www.cnblogs.com/ky027wh-sx/p/9629750.html

时间: 2024-09-30 18:48:42

《DSP using MATLAB》Problem 6.11的相关文章

《DSP using MATLAB》Problem 4.11

代码: %% ---------------------------------------------------------------------------- %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> Problem 4.11 \n\n'); banner

《DSP using MATLAB》Problem 5.11

代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> Problem 5.11 \n\n'); ba

《DSP using MATLAB》Problem 7.11

代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> Problem 7.11 \n\n'); ba

《DSP using MATLAB》 Problem 2.3

本题主要是显示周期序列的. 1.代码: %% ------------------------------------------------------------------------ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> Problem 2.3.1 \

《DSP using MATLAB》Problem 3.1

先写DTFT子函数: function [X] = dtft(x, n, w) %% ------------------------------------------------------------------------ %% Computes DTFT (Discrete-Time Fourier Transform) %% of Finite-Duration Sequence %% Note: NOT the most elegant way % [X] = dtft(x, n,

《DSP using MATLAB》Problem 5.14

说明:这两个小题的数学证明过程都不会,欢迎博友赐教. 直接上代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MA

《DSP using MATLAB》Problem 5.21

证明: 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> Problem 5.2

《DSP using MATLAB》Problem 7.36

代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> Problem 7.36 \n\n'); ba

《DSP using MATLAB》Problem 2.5

2.代码: %% ------------------------------------------------------------------------ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> Problem 2.5.2 \n\n'); time_st