Getting Error in saving values aftering filtering
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Explorer
am 28 Jan. 2016
Beantwortet: Star Strider
am 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 Kommentare
Akzeptierte Antwort
Star Strider
am 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Filter Banks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!