《DSP using MATLAB》Problem 8.15

代码:

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

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

Wp = 8*pi; Ws = 40*pi; Rp = 0.5; As = 45;
Fp = Wp/(2*pi);
Fs = Ws/(2*pi);

Ripple = 10 ^ (-Rp/20)
Attn = 10 ^ (-As/20)

% Analog filter design, DIRECT form:
[b, a] = afd(‘cheby1‘, Fp, Fs, Rp, As);
%[b, a] = afd_chb1(Wp, Ws, Rp, As);

% Calculation of second-order sections:
[C, B, A] = sdir2cas(b, a);

% Calculation of Frequency Response:
[db, mag, pha, ww] = freqs_m(b, a, 45*pi);

% Calculation of Impulse Response:
[ha, x, t] = impulse(b, a);

%% -------------------------------------------------
%%                    Plot
%% -------------------------------------------------  

figure(‘NumberTitle‘, ‘off‘, ‘Name‘, ‘Problem 8.15 Lowpass Analog Chebyshev-1‘)
set(gcf,‘Color‘,‘white‘);
M = 1.0;                          % Omega max

subplot(2,2,1); plot(ww/pi, mag);  grid on; axis([-45, 45, 0, 1.2]);
xlabel(‘ Analog frequency in \pi*1k units‘); ylabel(‘|H|‘); title(‘Magnitude in Absolute‘);
set(gca, ‘XTickMode‘, ‘manual‘, ‘XTick‘, [-45, -40, -8, 0, 8, 40, 45]);
set(gca, ‘YTickMode‘, ‘manual‘, ‘YTick‘, [0, 0.005, 0.94, 1]);

subplot(2,2,2); plot(ww/pi, db);  grid on; %axis([0, M, -50, 10]);
xlabel(‘Analog frequency in \pi*1k units‘); ylabel(‘Decibels‘); title(‘Magnitude in dB ‘);
set(gca, ‘XTickMode‘, ‘manual‘, ‘XTick‘, [-45, -40, -8, 0, 8, 40, 45]);
set(gca, ‘YTickMode‘, ‘manual‘, ‘YTick‘, [-70, -45, -1, 0]);
set(gca,‘YTickLabelMode‘,‘manual‘,‘YTickLabel‘,[‘70‘;‘45‘;‘ 1‘;‘ 0‘]);

subplot(2,2,3); plot(ww/pi, pha/pi);  grid on; axis([-45, 45, -1.2, 1.2]);
xlabel(‘Analog frequency in \pi*1k nuits‘); ylabel(‘radians‘); title(‘Phase Response‘);
set(gca, ‘XTickMode‘, ‘manual‘, ‘XTick‘, [-45, -40, -8, 0, 8, 40, 45]);
set(gca, ‘YTickMode‘, ‘manual‘, ‘YTick‘, [-1:0.5:1]);

subplot(2,2,4); plot(t, ha); grid on; %axis([0, 30, -0.05, 0.25]);
xlabel(‘time in seconds‘); ylabel(‘ha(t)‘); title(‘Impulse Response‘);

  运行结果:

通带、阻带绝对指标

模拟chebyshev-1型低通,系统函数直接形式

模拟低通,幅度谱、相位谱和脉冲响应

幅度谱通带部分放大后

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

时间: 2024-11-04 15:34:46

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

《DSP using MATLAB》Problem 2.15

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

《DSP using MATLAB》Problem 6.15

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

《DSP using MATLAB》Problem 7.15

用Kaiser窗方法设计一个台阶状滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> P

《DSP using MATLAB》Problem 3.4

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

《DSP using MATLAB》Problem 3.9

利用的频移性质为: 本习题代码: %% ------------------------------------------------------------------------ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> Problem 3.9 \n\n')

《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 5.13

1. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> Problem 5.13 \n\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