How to remove outliers and smooth the complex signals?

26 visualizaciones (últimos 30 días)
Susan
Susan el 27 de Ag. de 2021
Comentada: Star Strider el 7 de Sept. de 2021
Hi there,
I am working on a complex data set-- a 300-by-1000 matrix which each element is a complex number and each column of this matrix is considered as a single data stream.
I'd like to remove outliers and smooth the signal before any further invistigation. The Hample or rmoutliers filters are only work on real data. Any suggestions for me?
Does it make any sense to apply these filters on real and imag parts of a signal, say x, seperately and consider the new real(x)+j*imag(x) as the filtered data?
Thanks in advance!

Respuesta aceptada

Star Strider
Star Strider el 27 de Ag. de 2021
Does it make any sense to apply these filters on real and imag parts of a signal, say x, seperately and consider the new real(x)+j*imag(x) as the filtered data?
The easiest way to determine that is to do that experiment and see what the resullt is.
Z = complex(randn(12,1), randn(12,1))
Z =
-0.8833 - 1.3666i 1.7212 - 0.4963i 0.5758 - 0.5837i -0.6128 - 0.8870i 0.2242 + 0.4187i 0.6533 - 1.2172i -0.4661 - 0.8420i -0.4745 + 2.6053i 0.4623 - 0.2643i 1.4347 - 0.9645i 0.0386 + 0.2814i -0.1652 - 0.3177i
Query = [isoutlier(real(Z)) isoutlier(imag(Z))]
Query = 12×2 logical array
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
Zro = rmoutliers([real(Z) imag(Z)])
Zro = 11×2
-0.8833 -1.3666 1.7212 -0.4963 0.5758 -0.5837 -0.6128 -0.8870 0.2242 0.4187 0.6533 -1.2172 -0.4661 -0.8420 0.4623 -0.2643 1.4347 -0.9645 0.0386 0.2814
So the result is valid if either the real or imaginary parts of ‘Z’ (here) is an outlier. The entire row sill be removed, as expected. The result can then be reconstituted using the complex funciton, as I did originally to create it here.
.
  21 comentarios
Susan
Susan el 7 de Sept. de 2021
Thank you!!!!
Star Strider
Star Strider el 7 de Sept. de 2021
As always, my pleasure!
.

Iniciar sesión para comentar.

Más respuestas (1)

John D'Errico
John D'Errico el 27 de Ag. de 2021
Editada: John D'Errico el 27 de Ag. de 2021
Is it valid to work with the real and imaginary parts separately? Possibly, though you know the data better than we do. What causes an outlier? If there is a problem with the real component of a number, why would it not have impacted the imaginary part too?
I would assume you can simply work with the real and imaginary parts separately. But you cannot just REMOVE an outlier. You need to correct it. So you might decide to apply the tool filloutliers to each column of the arrray, separately to the real and complex parts, treating them as simply independent signals. That may not be totally valid of course. But can you do it? Of course.
You would use a loop over the columns of your matrix. Something like:
for ind = 1:ncols
R = filloutliers(real(M(:,ind)),'gesd');
I = filloutliers(imag(M(:,ind)),'gesd');
M(:,ind) = complex(R,I);
end
You would need to play around to find what works best on your data of course.
  1 comentario
Susan
Susan el 27 de Ag. de 2021
Editada: Susan el 27 de Ag. de 2021
Thank you so much for your reply. It maked me to think more about the problem and data set I am working on. When I apply your code on my data, I got the following error
Error using filloutliers>parseinput (line 236)
Expected input number 2, Fill, to match one of these values:
'center', 'clip', 'previous', 'next', 'nearest', 'linear', 'spline', 'pchip', 'makima'
The input, 'gesd', did not match any of the valid values.
Error in filloutliers (line 118)
parseinput(a, fill, varargin);
Any idea? Why did you select 'gesd' here?

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by