【 MATLAB 】nextpow2 函数用法之 Optimize FFT with Padding

版权声明:本博客内容来自于个人学习过程中的总结,参考了互联网以及书本、论文等上的内容,仅供学习交流使用,如有侵权,请联系我会重写!转载请注明地址! https://blog.csdn.net/Reborn_Lee/article/details/83062247

您可以使用nextpow2来填充传递给fft的信号。 这样做可以在信号长度不是2的精确幂次时加速FFT的计算。

Optimize FFT with Padding

下面这个例子展示了 使用填充优化FFT的案例,通过使用函数nextpow2完成:

clc
clear
close all
% Use the nextpow2 function to increase the performance of fft when the length of a signal is not a power of 2.
% 
% Create a 1-D vector containing 8191 sample values.

x = gallery('uniformdata',[1,8191],0);
% Calculate the next power of 2 higher than 8191.

p = nextpow2(8191);
n = 2^p
%get  n = 8192
% Pass the signal and the next power of 2 to the fft function.

y = fft(x,n);





上述的程序中有一个产生测试矩阵的函数x = gallery('uniformdata',[1,8191],0);,关于它的介绍见博文:【 MATLAB 】gallery 中的 uniformdata

猜你喜欢

转载自blog.csdn.net/Reborn_Lee/article/details/83062247