Correct Code for function Butter?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I need filter a data of displacement, and teh data is save in a txt file, this txt has 100 rows and 4 coluns. Until the begin of second for the code is working, but i think de last for doesn´t work. My frequency of acquisition is 210 Hz and my cutoff frequency is 6 Hz, and i need a low pass butterworth filter 4 ordem.
Sorry for my English.
clear all
Files=dir('filter*.txt');
[z,n]=size(Files);
for x=1:z
arq=load(Files(x).name);
[v,b]=size(arq);
for m=1:b
%4th order, with 6 Hz of cutoff frequency and 210Hz of acquisition
[a,b]=butter(4,6(210/2),'low');
exitfile(m,:)=filter(a,b.arq(m,:);
end
savefile=['clean','.',Files(x).name];
save(fullfile('c:','TCC',savefile,'exitfile','-ASCII');
end
2 commentaires
Jan
le 14 Nov 2012
The description "I think the last FOR does not work" does not contain enough information to allow for a specific answer. Please explain, why you assume that.
Btw.: The butter() command consumes some time, therefore it is more efficient to move it out of the loops.
Walter Roberson
le 14 Nov 2012
Réponses (1)
Jan
le 14 Nov 2012
In the line
[a,b]=butter(4,6(210/2),'low');
the expression "6(210/2)" is no valid Matlab syntax. Do you mean "6 * (210 / 2)"?
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!