Running data through a filter multiple times
Ältere Kommentare anzeigen
I'm trying write a function that will run data through a chebyshev type 2 filter a number of times. I currently have written this which doesn't work and I'm currently struggling with how to fix it or wether I'm attacking this completely wrong. To build the filter im using [bd,ad]=cheby2(N,R,Wst). I also need to have each stage of the dataout saved.
function [datafiltered]casfilter(bd,ad,data,nfilters)
% CASFILTER - pass data through a filter defined bd and ad n number of
% times and give datafiltered. n>1.
%
% useage: [datafiltered]=casfilter(bd,ad,data,nfilters)
%
% Elliot Jones, 21st June 2020
[dataout1,zout1]=filter(bd,ad,data);
for n=1:(nfilters-1)
[dataout"n+1",zout"n+1"]=filter(bd,ad,dataout"n",zout"n");
end
dataout"n"=datafiltered
end
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!