How to remove outliers and smooth the complex signals?
20 views (last 30 days)
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!
Star Strider on 27 Aug 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))
Query = [isoutlier(real(Z)) isoutlier(imag(Z))]
Zro = rmoutliers([real(Z) imag(Z)])
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.
More Answers (1)
John D'Errico on 27 Aug 2021
Edited: John D'Errico on 27 Aug 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);
You would need to play around to find what works best on your data of course.