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
Few Ideas:
- 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.
- 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.
- 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).
- Use FFT manually to perform convolution.
- Create a MEX version of Intel MKL / Intel IPP filter function.
Any of these should help considerably.