digital filters: very different results using filter object and b,a coefficients

1 Ansicht (letzte 30 Tage)
Hello,
I'm comparing the output of digital filtering using matlab filter object and b-a coefficients using tf function, and they are really different. I'll appreciate if anyone coulf point me out in the right direction. Here my results and the test script:
filters.png
srate=64;
freqrange=[0.4 3.5];
file='data.txt';
load(file);
file=split(file,'.');
file=file{1};
data=eval(file);
st=srate*60;
ed=srate*60*2;
data=data(st:ed);%1 minute data
m=numel(data);
x=data;
R=0.1;%10% of signal
Nr=50;
NR=min(round(m*R),Nr);%At most 50 points
x1=2*x(1)-flipud(x(2:NR+1));%maintain continuity in level and slope
x2=2*x(end)-flipud(x(end-NR:end-1));
x=[x1;x;x2];
[xx,dbp]=bandpass(x,freqrange,srate);
data_fil=xx(NR+1:end-NR);
[b,a]=dbp.tf;
xx=filter(b,a,x);
data_fil_ba=xx(NR+1:end-NR);
f=figure;
s(1)=subplot(2,1,1,'Parent',f);
plot(s(1),[data data_fil])
title(s(1),'dbp')
s(2)=subplot(2,1,2,'Parent',f);
plot(s(2),[data data_fil_ba])
title(s(2),'ba')
linkaxes(s,'x');

Antworten (0)

Kategorien

Mehr zu Measurements and Feature Extraction 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!

Translated by