フィルターのクリア

Creating a Chebychev Type 1 and Butterworth Notch filter

3 ビュー (過去 30 日間)
Terry Carney
Terry Carney 2021 年 5 月 14 日
コメント済み: Terry Carney 2021 年 5 月 15 日
Hello,
I'm trying to create both a Chebychev Type 1 and Butterworth Notch filter. The filters have to produce a min attenuation of 60dB at 10Hz, with a rippe of .01dB. However, I keep getting a syntax error that I'm confused with: "The cutoff frequencies must be within the interval of (0,1)."
I guess I'm confused on how to interpret this information into code, along with filtfilt and fvtool. Is this the expected value?
%Setting up signal:
fs = 200; %Sample Frequency
Ts = 1/fs; %Sample Period
t = 0:Ts:9.9950;
x = load("data2.txt");
plot(t,x);
%My cheby1 example
b = cheby1(2,.01,.1)
x2 = filtfilt(b,1,x)
fvtool(b,1)
plot(t,x2)
I'm assuming if I'm on the right track with cheby1, butterworth should be similar.
  4 件のコメント
Mathieu NOE
Mathieu NOE 2021 年 5 月 15 日
hello
below a minor bug correction, as the cheb filter has a numerator (B) and a denominator (A) (you put 1 there which is not correct)
otherwise the rest is fine
%Setting up signal:
fs = 200; %Sample Frequency
Ts = 1/fs; %Sample Period
t = 0:Ts:9.9950;
%x = load("data2.txt");
x = randn(length(t),1);
plot(t,x);
%My cheby1 example
fc = 10;
[B,A] = cheby1(2,.01,fc/(fs/2))
x2 = filtfilt(B,A,x)
fvtool(B,A)
plot(t,x2)
Terry Carney
Terry Carney 2021 年 5 月 15 日
I figured it out. Thank you though.

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

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by