Hampel filter (built-in) in matlab 2016b way faster than the one from the file exchange

조회 수: 1 (최근 30일)
Hi all,
I am using a 32 bit pc for my analysis, which limits me to matlab 2015. The hampel filter is introduced in matlab 2016.
There is a hampel filter in the file exchange which produced the same results compared to 2016.
https://nl.mathworks.com/matlabcentral/fileexchange/34795-outlier-detection-and-removal--hampel-
However, this filter needs to have the input of the time as well. Not a real problem, but for some reason this filter lasts about 100 seconds (1500000 points) while in matlab 2016 it only lasts a few seconds.
due to privacy I can't use the 2016 pc so I hope there is a solution for this! :)
Greetings Martijn
  댓글 수: 3
KFrenkie
KFrenkie 2017년 3월 22일
The example in the file exchange requires a time input. The signal is uniformly sampled (10Hz) and while it uses 3 neighbouring datapoints on each side, its a time window of 7. At least, that's what I think it does..
example: x=[1 2 3 4 5 6 7 8 9 10] data=[1 2 3 15 5 6 7 8 9 10]
In 2016, i can use [filtered]=hampel(data).
in 2015, it requires [filtered]=hampel(x,data).
For a large dataset, the 2015 matlab version, requiring the file-exchange one, takes really long.
Greg Dionne
Greg Dionne 2017년 3월 22일
OK. Have you tried the MEX file FEX submission that does the uniformly-sampled version? Put it in a directory and do "mex hampelFilter.cpp" and try running it. Hopefully it will compile and work ok.
It seemed to work fine for me:
>> mex hampelFilter.cpp
Building with 'Microsoft Visual C++ 2015 Professional'.
MEX completed successfully.
>> data=[1 2 3 15 5 6 7 8 9 10];
>> hampelFilter(data, 3, 3)
ans =
1 2 3 5 5 6 7 8 9 10

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2017년 3월 22일
편집: Jan 2017년 3월 22일
The main work inside Matlab's hampel function is done in movmad.mexw64, a compiled executable for Windows 64. There is no chance to run it on a 32 bit system.
There is some potential to improve the FEX version. Most of all replacing the moving median filter by a C-mex function. To check if more simplifications are possible:
  • Is your x always 1:numel(data)?
  • Do you use the 'standard' or the 'adaptive' method?

카테고리

Help CenterFile Exchange에서 Verification, Validation, and Test에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by