Correct Code for function Butter?

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 Kommentare

Jan
Jan am 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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jan
Jan am 14 Nov. 2012

0 Stimmen

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)"?

Gefragt:

am 14 Nov. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by