
このコードにIIRフィルターを組み込みたいです
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
clear;
close all
Dat= load('output.txt');
t= Dat(:,1); %時間データをtに入れる
v= Dat(:,2); %電圧データをvに入れる
subplot(2,1,1)
plot(t,v)
title('Original Signal')
xlabel('Time (s)')
ylabel('電圧(V) ')
ys = ylim;
subplot(2,1,2)
plot(t,filtered)
title('Lowpass Filtered Signal')
xlabel('Time (s)')
ylabel('電圧(V) ')
ylim(ys)
0 Kommentare
Antworten (2)
Hernia Baby
am 21 Jan. 2023
fs = 1e3;
t = 0:1/fs:1;
v = [1 2]*sin(2*pi*[50 250]'.*t) + randn(size(t))/10;
■ここでタスクを使います
挿入 > タスク > フィルタ設計を選びます
■設定は以下のようにしました

■以下のコードは自動生成されます
% デジタル フィルターの設計
Myfilter = designfilt('lowpassiir', ...
'FilterOrder',5,'PassbandFrequency',100, ...
'PassbandRipple',1,'SampleRate',fs);
% 振幅応答と位相応答の可視化
freqz(Myfilter.Coefficients,[],fs)
■フィルタを掛けます
filtered = filtfilt(Myfilter,v);
■図示します。
figure
subplot(2,1,1)
plot(t,v)
title('Original Signal')
xlabel('Time (s)')
ylabel('電圧(V) ')
ys = ylim;
subplot(2,1,2)
plot(t,filtered)
title('Lowpass Filtered Signal')
xlabel('Time (s)')
ylabel('電圧(V) ')
ylim(ys)
0 Kommentare
Atsushi Ueno
am 21 Jan. 2023
Bearbeitet: Atsushi Ueno
am 21 Jan. 2023
上記ローパスフィルタの事例を提示されたプログラムに当てはめてみました。
clear;
close all
fs = 1e3;
t = 0:1/fs:1;
v = [1 2]*sin(2*pi*[50 250]'.*t) + randn(size(t))/10;
filtered = lowpass(v,150,fs);
subplot(2,1,1)
plot(t,v)
title('Original Signal')
xlabel('Time (s)')
ylabel('電圧(V) ')
ys = ylim;
subplot(2,1,2)
plot(t,filtered)
title('Lowpass Filtered Signal')
xlabel('Time (s)')
ylabel('電圧(V) ')
ylim(ys)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matched Filter and Ambiguity Function finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

