问题
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:
- If you have FIR filter (As it seems from the code) you may gain performance using
conv2which uses Intel IPP which might speed things up. Use the 'valid' flag to getfilterresults. - If the filter is long and the data is long, try using
xcorras it uses FFT to speed up correlations. Since you're after filtering, remember to flip your filter coefficients. - Compile
filterXusing Visual Studio 2013 or even better Intel C Compiler 2013 with optimization flags (/03). When using it, use thefilterXcommand directly (SkipFilterMwrapper). - Use FFT manually to perform convolution.
- 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