Speed up MATLAB filter command

北慕城南 提交于 2019-12-25 02:58:16

问题


I am relatively new to using MATLAB filters. I am trying to filter a fairly large data set (about 2 million data points) using the following commands

rrc = rcosdesign(0.25, 10, floor(Fs/symRate), 'sqrt');
filtered = filter(rrc, 1, samples);
filtered = filtered / sqrt(floor(Fs/symRate));

When I run the MATLAB Profiler, it says the line

filtered = filter(rrc, 1, samples);

takes over 500 seconds to run. Any ideas on how to speed this up? I have tried using a FilterM function I found online ( http://www.mathworks.com/matlabcentral/fileexchange/32261-filterm ) but it takes the same amount of time. Anyone else have any ideas?

Thanks in advance


回答1:


Few Ideas:

  1. If you have FIR filter (As it seems from the code) you may gain performance using conv2 which uses Intel IPP which might speed things up. Use the 'valid' flag to get filter results.
  2. If the filter is long and the data is long, try using xcorr as it uses FFT to speed up correlations. Since you're after filtering, remember to flip your filter coefficients.
  3. Compile filterX using Visual Studio 2013 or even better Intel C Compiler 2013 with optimization flags (/03). When using it, use the filterX command directly (Skip FilterM wrapper).
  4. Use FFT manually to perform convolution.
  5. Create a MEX version of Intel MKL / Intel IPP filter function.

Any of these should help considerably.



来源:https://stackoverflow.com/questions/24415218/speed-up-matlab-filter-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!