Filtering a matrix column with different cutoff

조회 수: 1 (최근 30일)
Bruno
Bruno 2016년 3월 26일
댓글: Bruno 2016년 3월 26일
I’ ve looking for a method to filter each column of data (101X62) with specific cutoff (1X63). Please, could someone indicate me the problem? Thanks B
x=data
fs=60;
fc=cutoff;
for idx = 1:numel(x);
[b,a] = butter(2, fc/(fs/2));
y = filter(b,a,x); %// output
end
  댓글 수: 3
Bruno
Bruno 2016년 3월 26일
Hi Ced, cutoff frequency (1x62) are different for each column.
Ced
Ced 2016년 3월 26일
Yes, but since you are designing your filter in the loop, you can select a different cutoff for each loop iteration, right? Have a look at Image Analyst's answer, he wrote it out for you. You of course still have to define your cutoff vector.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2016년 3월 26일
편집: Image Analyst 2016년 3월 26일
Perhaps you meant this:
[rows, columns] = size(data);
y = zeros(size(data));
fs = 60;
for k = 1 : columns
thisColumn = data(:, k); % Extract this one column
fc = cutoff(k); % Extract this one cutoff value.
% Determine filter parameters.
[b,a] = butter(2, fc/(fs/2));
% Do the filtering, and put result into column k of the output y
y(:,k) = filter(b, a, thisColumn);
end
  댓글 수: 3
Image Analyst
Image Analyst 2016년 3월 26일
Try
[rows, columns] = size(data);
where data is whatever you called your 2-D array.
Bruno
Bruno 2016년 3월 26일
Thanks, is working now.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by