バタワースフィルター (LPF) の周波数スペクトルの書き方

24 views (last 30 days)
N/A
N/A on 30 Oct 2019
Commented: N/A on 31 Oct 2019
以下は、バタワースフィルター(LPF)のプログラムです。Trace_1は10MHzのsin波のデータ(横軸:時間、縦軸:電圧)です。
x1=Trace_1;
fc=1*10^6;%フィルターのカットオフ周波数
fs=100*10^6;%サンプリング周波数
[b,a]=butter(50,fc/(fs/2));
%freqz(b,a)
x2=filter(b,a,x1);
plot(x2);
バタワースフィルターとx2 (バタワースフィルターにx1を通した後の信号) の周波数スペクトル ( 横軸:周波数(Hz)、縦軸:利得(dB) )の出力方法を教えていただけませんか?ご回答お待ちしております。
  1 Comment
Yoshio
Yoshio on 31 Oct 2019
t = Trace_1(:,1);
x = Trace_1(:,2);
plot(t,x)
fs = 1/(t(2)-t(1))
fs =
2.0000e+09
となっていますので、サンプリング周波数の設定は2GHzだと思います。
またfilter(b,a,x1)としていまうと、時系列ベクトルtまでフィルタすることになります。

Sign in to comment.

Accepted Answer

Yoshio
Yoshio on 31 Oct 2019
先のコメントにも書きましたが、まずご自身のデータTrace_1について理解してください。その上で以下のプログラムが参考になればと思います。
t = Trace_1(:,1);
x = Trace_1(:,2);
plot(t,x)
fs = 1/(t(2)-t(1))
fc = 10^6;
[b,a]=butter(3,fc/(fs/2));
freqz(b,a)
y=filter(b,a,x);
figure
plot(t,[x y]);
grid on;
legend('x','y')
figure
[p,f] = pspectrum([x y],fs);
plot(f,pow2db(p))
grid on
xlabel('Frequency (Hz)')
ylabel('Power Spectrum (dB)')
  1 Comment
N/A
N/A on 31 Oct 2019
ご回答頂きありがとうございます。
周波数スペクトルを出力することが出来ました。

Sign in to comment.

More Answers (0)

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!