Getting Error in saving values aftering filtering

2 次查看(过去 30 天)
load matrix
Fs=256;
Fn = Fs/2; % Nyquist Frequency
Wp = [2 95]/Fn; % Filter Passband (Normalised)
Ws = Wp .* [0.5 1.2]; % Filter Stopband (Normalised)
Rp=1; % Passband ripple
Rs= 50; % Stopband ripple
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % n is minimum order and Ws is cut-off freq
[b,a] = cheby2(n, Rs, Ws) ;
for k= 1:size(splitedParts,2)
y(k)= filtfilt(b,a,splitedParts (:,k) ) ;
end
There is a matrix of 1024 x 1953 order. I want to save matrix after applying filter in variable 'y'. It should be like if column 1 of splitedParts is filtered, it must be save in column 1 of variable 'y', filtered column2 values must be save in column 2 of variable and so on.
Error I was facing:
In an assignment A(I) = B, the number of elements in B and I must be the same.

采纳的回答

Star Strider
Star Strider 2016-1-28
Since ‘splitedParts’ is a column vector in each pass, ‘y’ will also be.
Providing (assuming) all are the same length, this will work:
y(:,k)= filtfilt(b,a,splitedParts (:,k) ) ;
an alternative is a cell array:
y{k}= filtfilt(b,a,splitedParts (:,k) ) ;
Note the curly brackets ‘{}’ in the cell array version.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Filter Banks 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by