フィルタのゲインと入​力信号の振幅の関係が​わからないので教えて​ください。

2 views (last 30 days)
K_S_
K_S_ on 28 Jul 2022
Commented: K_S_ on 2 Aug 2022
ノッチフィルタが機能していることを確認するため、
正弦波信号を入力し、出力結果の周波数解析を行って減衰量の確認を行いたいと考えています。
そのため、添付した下記のコードとsimlinkモデルを実行しました。
その結果、50Hzでフィルタのゲインを0.1倍としたので出力の振幅も0.1倍になるかと考えていたのですが、なりませんでした。
何故でしょうか。
Matlabではなく周波数解析の知識の欠如が原因かもしれませんが、教えていただきたいです。
%% サンプリング設定
fs = 1000; % サンプリング周波数 [Hz]
Ts = 1/fs;
ntrans = 1000; % 過渡応答のサンプリング数
nsteady = 1000; % 定常応答のサンプリング数
nn = ntrans + nsteady;
Tsim = nn*Ts;
t = (0:nn)'*Ts;
%% 入力設定 %%
ampli = 100; % sin波 振幅
fn =50; % sin波 周波数
%% ノッチフィルタ設定 %%
wn = 2*pi*fn;
zeta = 0.1;
d = 0.1;
b = [1 2*d*zeta*wn wn^2];
a = [1 2*zeta*wn wn^2];
H = tf(b,a);
figure(1)
title('Bode Plot of Notch Filter')
bode(H)
filename = 'test_simlink.slx'
open_system(filename)
out = sim(filename)
figure(2)
x = out.x;
plot(t,x)
title('Input Signal x(t)')
xlabel('t (sec)')
ylabel('x')
figure(3)
y = out.y;
plot(t,y)
title('Output Signal y(t)')
xlabel('t (sec)')
ylabel('y')
%% FFT %%
x = x(ntrans+2:end,1);
X = fft(x);
L = length(x);
X = abs(X/L);
X = X(1:L/2+1);
X(2:end-1) = 2*X(2:end-1);
f = fs*(0:(L/2))/L;
figure(4)
plot(f,X)
title('Single-Sided Amplitude Spectrum of x(t)')
xlabel('f (Hz)')
ylabel('|X(f)|')
y = y(ntrans+2:end,1);
Y = fft(y);
L = length(y);
Y = abs(Y/L);
Y = Y(1:L/2+1);
Y(2:end-1) = 2*Y(2:end-1);
f = fs*(0:(L/2))/L;
figure(5)
plot(f,Y)
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('f (Hz)')
ylabel('|Y(f)|')
  2 Comments
K_S_
K_S_ on 2 Aug 2022
ご回答いただきありがとうございました。非常に助かりました。

Sign in to comment.

Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!