このコードにIIRフィルターを組み込みたいです
Afficher commentaires plus anciens
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)
Réponses (2)
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)
Atsushi Ueno
le 21 Jan 2023
Modifié(e) : Atsushi Ueno
le 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)
Catégories
En savoir plus sur Matched Filter and Ambiguity Function dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

