Command for filling in zeros as powers of 2 for FT

8 views (last 30 days)
FW
FW on 8 Apr 2019
Edited: FW on 11 Apr 2019
If we two sets of signals (A and B) of unequal length, I am using zero padding first to make the length of B equal to A by using B_new = [B zeros(1,(length(A)-length(B)))]. This step is necessary because we would like to divide A by B in the frequency domain. Before the division process, I would like to make the length of A and B equal to a power of 2. What command should we use in MATLAB 2017b? If there is a better way to combine these two steps as well? Thanks

Accepted Answer

Matt J
Matt J on 9 Apr 2019
N=nextpow2(max(numel(a),numel(b)));
A=fft(a,N);
B=fft(b,N);
  2 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by