# How to set the length of fft

**URL:** https://discourse.julialang.org/t/how-to-set-the-length-of-fft/38885
**Category:** General Usage
**Tags:** fftw
**Created:** [May 6, 2020, 1:23pm UTC](https://discourse.julialang.org/t/how-to-set-the-length-of-fft/38885 "2020-05-06T13:23:55Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [May 6, 2020, 2:00pm UTC](https://discourse.julialang.org/t/how-to-set-the-length-of-fft/38885/2 "2020-05-06T14:00:29Z")

</div>

> [@Andy.Yang](#):
>
> I can’t find how to set the length of FFTW.fft, just like python or matlab.

“Setting the length” in Matlab’s `fft` function just corresponds to zero-padding or truncating the data, which you can easily do manually:

```julia
newdata = zeros(newlength)
newdata[1:length(olddata)] = olddata

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-set-the-length-of-fft/38885)._
