For the following digital specifications

Version 2.00 (14.9 KB) by jeevitha
For the following digital specifications 1 ≤ |𝐻(𝑒 𝑗Ω)| ≤ 0.8 0 ≤ Ω ≤ 800 Hz |𝐻(𝑒 𝑗Ω)| ≤ 0.2 2.4 kHz ≤ Ω ≤ 4 kHz Write code to simulate
6 Downloads
Updated 28 Apr 2024

View License

clear all;
close all;
clc;
% Given specifications
alphap = 20*log10(1) - 20*log10(0.8); % Passband attenuation
alphas = 20*log10(1) - 20*log10(0.2); % Stopband attenuation
op = 2 * tan(0.1 * pi); % Analog passband frequency
os = 2 * tan(0.3 * pi); % Analog stopband frequency
% Calculations
k1 = abs(os/op);
A1 = (10^(0.1*alphas) - 1)^0.5;
A2 = (10^(0.1*alphap) - 1)^0.5;
A = A1 / A2;
N = ceil(A / k1); % Order of the transfer function
k3 = 1 / (2 * N);
k4 = (10^(0.1*alphap) - 1)^k3;
oc = op / k4; % Cutoff frequency calculation
% Design the Butterworth filter
[b, a] = butter(N, oc);
% Plot frequency response
w = 0:.01:pi;
[h, om] = freqz(b, a, w, 'whole');
m = abs(h);
an = angle(h);
subplot(2,1,1)
plot(om/pi, m), grid, ylabel('Normalized Magnitude'), xlabel('Normalized Frequency');
subplot(2,1,2)
plot(om/pi, an), grid, ylabel('Angle'), xlabel('Normalized Frequency');
% Impulse invariant transformation
[bz1, az1] = impinvar(b, a, 1); % Impulse invariant transform of the function
% Bilinear transformation
[bz2, az2] = bilinear(b, a, 1); % Bilinear transform of the function

Cite As

jeevitha (2026). For the following digital specifications (https://www.mathworks.com/matlabcentral/fileexchange/164731-for-the-following-digital-specifications), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Version Published Release Notes
2.00

signal processing

1.0.0