Problem with toolbox filter design?

Hi everybody, I need help with disigning filters in matlab:
I was designed a bandpass filter in the toolbox and export it like an object to my workspace, then I tried to filter data with it using the comand filtfilt, the problem es that this comand don't recognize this filter as a matrix so when i use the follow linecommand: a11=filtfilt(Fil1,a1); i recived the follow error "Not enough input arguments". The Fs frecuency of the filter is 1000Hz, the Flowpass is 10Hz and the Fhighpass is 14Hz. Apass 1dB. Type Chebychev Type 1.
thanks

Réponses (1)

Wayne King
Wayne King le 15 Juin 2013
Modifié(e) : Wayne King le 15 Juin 2013

0 votes

Assume that Fil1 is your filter object, if you enter
class(Fil1)
does it return dfilt.df2sos?
If so, then depending on what version of MATLAB you are using, try:
out = filtfilt(Fil1.sosMatrix,Fil1.ScaleValues,a1);
where a1 is your data.
If you have an older version of MATLAB where the above command does not work, write back.

7 commentaires

Stefan Leiva
Stefan Leiva le 15 Juin 2013
Modifié(e) : Stefan Leiva le 15 Juin 2013
Hi Wayne, when I wrote the command all the vector out is fill with NaN values, when I wrote Fil1.sosMatrix shows: >> Fil1.sosMatrix
ans =
1.0000 0 -1.0000 1.0000 -1.9964 0.9973
1.0000 0 -1.0000 1.0000 -1.9987 0.9993
1.0000 0 -1.0000 1.0000 -1.9978 0.9990
1.0000 0 -1.0000 1.0000 -1.9973 0.9980
1.0000 0 -1.0000 1.0000 -1.9965 0.9976
and when I wrote
Fil1.ScaleValues
ans =
0.0001
0.0011
0.0109
0.0018
0.0083
19.7438
What can i do?
thanks.
Wayne King
Wayne King le 16 Juin 2013
Did the command at least run? It did not throw an error?
Do you have NaNs in your data? If you have any NaNs in your data, then you will only get NaNs out.
Stefan Leiva
Stefan Leiva le 16 Juin 2013
I don´t have NaNs in my data. When I use the command Filter, it works, my problem is that the filter comand moves the response (filter data), I think that it could be becouse of the phase angle. I want to try with this comand.
That is strange because I don't have any trouble with your filter. Can you try this:
n = 0:499;
x = cos(0.01*pi*n)+sin(pi/4*n)+randn(size(n));
y = filtfilt(Fil1.sosMatrix,Fil1.ScaleValues,x);
Do you get NaNs in your output with the above?
Stefan Leiva
Stefan Leiva le 16 Juin 2013
Modifié(e) : Stefan Leiva le 16 Juin 2013
with your answer also have Nans, can I send you the folder with all my data?, I think it´s strange too. the link with data is https://www.dropbox.com/s/gtp3k9g5cygjpru/Puente%20San%20Luis%2001-P-012%20K14%2B378.zip. Thanks
Are you using the MathWorks' version of filtfilt()? If you enter
>>which filtfilt
what do you get returned?
Stefan Leiva
Stefan Leiva le 17 Juin 2013
it is what it returns: C:\Program Files\MATLAB\R2008a\toolbox\signal\signal\filtfilt.m

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by