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

您可以使用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);

33488db34ef7476f84e1626875177b68.png

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

本文同步分享在 博客“李锐博恩”(CSDN)。

如有侵权,请联系 support@oschina.cn 删除。

本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值