加速MATLAB过滤器命令 [英] Speed up MATLAB filter command

查看:88
本文介绍了加速MATLAB过滤器命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用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?

预先感谢

推荐答案

一些想法:

  1. 如果您具有FIR滤波器(如代码所示),则可以使用conv2获得性能,该conv2使用Intel IPP可以加快速度.使用有效"标志获取filter结果.
  2. 如果过滤器很长且数据很长,请尝试使用xcorr,因为它使用FFT来加快相关性.由于您要进行滤波,因此请记住将滤波系数翻转.
  3. 使用Visual Studio 2013甚至更好的带有优化标志(/03)的Intel C Compiler 2013编译filterX.使用时,直接使用filterX命令(跳过FilterM包装器).
  4. 手动使用FFT进行卷积.
  5. 创建Intel MKL/Intel IPP过滤器功能的MEX版本.
  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.

这篇关于加速MATLAB过滤器命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆