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

3 Ansichten (letzte 30 Tage)
kira am 13 Nov. 2019
Kommentiert: Daniel M am 14 Nov. 2019
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:
srate=64;
freqrange=[0.4 3.5];
file='data.txt';
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')
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Daniel M am 14 Nov. 2019

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Image Category Classification 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