Correct Code for function Butter?
조회 수: 5 (최근 30일)
이전 댓글 표시
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
Jan
2012년 11월 14일
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
2012년 11월 14일
답변 (1개)
Jan
2012년 11월 14일
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)"?
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!