Getting Error in saving values aftering filtering
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Explorer
le 28 Jan 2016
Réponse apportée : Star Strider
le 28 Jan 2016
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.
0 commentaires
Réponse acceptée
Star Strider
le 28 Jan 2016
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Filter Banks dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!