加速MATLAB过滤器命令 [英] Speed up MATLAB filter command
问题描述
使用MATLAB过滤器相对较新.我正在尝试使用以下命令过滤相当大的数据集(约200万个数据点)
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));
当我运行MATLAB Profiler时,它会显示
When I run the MATLAB Profiler, it says the line
filtered = filter(rrc, 1, samples);
需要500秒钟才能运行.关于如何加快速度的任何想法?我尝试使用在线找到的FilterM函数( http://www.mathworks.com/matlabcentral/fileexchange/32261-filterm ),但所需的时间相同.其他人有什么想法吗?
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?
预先感谢
推荐答案
一些想法:
- 如果您具有FIR滤波器(如代码所示),则可以使用
conv2
获得性能,该conv2
使用Intel IPP可以加快速度.使用有效"标志获取filter
结果. - 如果过滤器很长且数据很长,请尝试使用
xcorr
,因为它使用FFT来加快相关性.由于您要进行滤波,因此请记住将滤波系数翻转. - 使用Visual Studio 2013甚至更好的带有优化标志(
/03
)的Intel C Compiler 2013编译filterX
.使用时,直接使用filterX
命令(跳过FilterM
包装器). - 手动使用FFT进行卷积.
- 创建Intel MKL/Intel IPP过滤器功能的MEX版本.
- 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 getfilter
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 thefilterX
command directly (SkipFilterM
wrapper). - Use FFT manually to perform convolution.
- Create a MEX version of Intel MKL / Intel IPP filter function.
其中任何一个都应该有很大帮助.
Any of these should help considerably.
这篇关于加速MATLAB过滤器命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!