フィルターのクリア

Butterworth lowpass filtering without signal processing toolbox

60 ビュー (過去 30 日間)
John
John 2014 年 6 月 26 日
回答済み: Fiza 2020 年 9 月 8 日
Hi,
I'm trying to accomplish butterworth lowpass filtering but do not have the signal processing toolbox. Is it possible to do this type of filtering without this toolbox?

回答 (3 件)

Jan
Jan 2014 年 6 月 26 日
編集済み: Jan 2014 年 7 月 7 日
This is a fair method to determine the coefficients for a Butterworth filter:
function [Z, P, G] = myButter(n, W, pass)
% Digital Butterworth filter, either 2 or 3 outputs
% Jan Simon, 2014, BSD licence
% See docs of BUTTER for input and output
% Fast hack with limited accuracy: Handle with care!
% Until n=15 the relative difference to Matlab's BUTTER is < 100*eps
V = tan(W * 1.5707963267948966);
Q = exp((1.5707963267948966i / n) * ((2 + n - 1):2:(3 * n - 1)));
nQ = length(Q);
switch lower(pass)
case 'stop'
Sg = 1 / prod(-Q);
c = -V(1) * V(2);
b = (V(2) - V(1)) * 0.5 ./ Q;
d = sqrt(b .* b + c);
Sp = [b + d, b - d];
Sz = sqrt(c) * (-1) .^ (0:2 * nQ - 1);
case 'bandpass'
Sg = (V(2) - V(1)) ^ nQ;
b = (V(2) - V(1)) * 0.5 * Q;
d = sqrt(b .* b - V(1) * V(2));
Sp = [b + d, b - d];
Sz = zeros(1, nQ);
case 'high'
Sg = 1 ./ prod(-Q);
Sp = V ./ Q;
Sz = zeros(1, nQ);
case 'low'
Sg = V ^ nQ;
Sp = V * Q;
Sz = [];
otherwise
error('user:myButter:badFilter', 'Unknown filter type: %s', pass)
end
% Bilinear transform:
P = (1 + Sp) ./ (1 - Sp);
Z = repmat(-1, size(P));
if isempty(Sz)
G = real(Sg / prod(1 - Sp));
else
G = real(Sg * prod(1 - Sz) / prod(1 - Sp));
Z(1:length(Sz)) = (1 + Sz) ./ (1 - Sz);
end
% From Zeros, Poles and Gain to B (numerator) and A (denominator):
if nargout == 2
Z = G * real(poly(Z'));
P = real(poly(P));
end
  2 件のコメント
erico vale
erico vale 2018 年 6 月 20 日
Could you comment the code ?
Eduardo Rey
Eduardo Rey 2020 年 3 月 14 日
Jan, I tried using this code to get coefficents for a low-pass response using n=1, w = 0.04 since fs=2K and fc = 40Hz but it gave me -1. Am I doing something wrong?

サインインしてコメントする。


Anastasios
Anastasios 2014 年 6 月 26 日
Hi John,
You can download a 30-day free trial if you want to do something for now
https://www.mathworks.com/programs/trials/trial_request.html?prodcode=SG&eventid=616177282&s_iid=main_trial_SG_cta2
Tasos
  2 件のコメント
John
John 2014 年 6 月 26 日
That's not an option for now, and that decision doesn't come from me. Is there another option you can think of?
Anastasios
Anastasios 2014 年 6 月 26 日
Check the following webpage at Rice University. Hopefully you can find your answer there. 2D Frequency Domain Filtering and the 2D DFT

サインインしてコメントする。


Fiza
Fiza 2020 年 9 月 8 日
Hi,
Under what license can i use this code?

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by