Borrar filtros
Borrar filtros

Getting Error in saving values aftering filtering

2 visualizaciones (últimos 30 días)
Explorer
Explorer el 28 de En. de 2016
Respondida: Star Strider el 28 de En. de 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.

Respuesta aceptada

Star Strider
Star Strider el 28 de En. de 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.

Más respuestas (0)

Categorías

Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by