EDA365电子论坛网
标题:
MATLAB —— 介绍一下nextpow2 函数的 Optimize FFT with Padding 用法
[打印本页]
作者:
mytomorrow
时间:
2019-12-10 09:58
标题:
MATLAB —— 介绍一下nextpow2 函数的 Optimize FFT with Padding 用法
本帖最后由 mytomorrow 于 2019-12-10 10:01 编辑
& f' y% [ m7 Y# ^$ M4 {
, U( M$ A: o+ m7 `
* x* c; X% ~7 q! p G8 x
您可以使用nextpow2来填充传递给fft的信号。 这样做可以在信号长度不是2的精确幂次时加速FFT的计算。
5 c* p! o1 \0 h( a4 [5 w
9 |9 E! _1 ~7 V A" m9 n1 }* z
Optimize FFT with Padding
, a5 ]& ~( @7 C0 z& T% l: m, ^" W
5 g; i: ?, z& n% j, r! @
下面这个例子展示了 使用填充优化FFT的案例,通过使用函数nextpow2完成:
% f& ^3 _8 Z5 C2 J
Q1 c7 e. U# O) e
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.
: i( E( p; P: K
x = gallery('uniformdata',[1,8191],0);
% Calculate the next power of 2 higher than 8191.
# x4 e( b% j# Z- p; b) Q0 J
p = nextpow2(8191);
n = 2^p
%get n = 8192
% Pass the signal and the next power of 2 to the fft function.
( v i5 o" ?) S9 m/ S
y = fft(x,n);
- B0 `; j4 t3 S
; [7 \ V/ y k
4 O6 \4 Z( D& e5 m6 ?7 l& r3 \
% K* g! ?7 t) y9 {! N2 V
" x) L7 U* A# o' d0 c
S% K$ Z, ]' ]
6 v D& H" F+ K' X
; }( x+ t! ^* F5 f- [) }) V6 E
+ O) |+ V0 w* y8 W; t, A
介绍一下nextpow2-1.png
(12.74 KB, 下载次数: 3)
下载附件
保存到相册
2019-12-10 09:57 上传
0 y8 f; h( T# ^
- `6 {& H; d; ^ b
上述的程序中有一个产生测试矩阵的函数x = gallery('uniformdata',[1,8191],0);,关于它的介绍见上篇:
MATLAB —— 认识一下gallery 中的 uniformdata
" q5 f7 l% b* B, M4 V1 d
/ i( e# l. G5 x& i: E7 ]- `" `
作者:
sharkN
时间:
2019-12-10 19:38
谢谢分享
欢迎光临 EDA365电子论坛网 (https://eda365.com/)
Powered by Discuz! X3.2