# Fft(x,n) when n\>length(x)

**URL:** <https://discourse.julialang.org/t/fft-x-n-when-n-length-x/69308>\
**Category:** General Usage\
**Tags:** question, fftw\
**Created:** [October 6, 2021, 2:20pm UTC](https://discourse.julialang.org/t/fft-x-n-when-n-length-x/69308 "2021-10-06T14:20:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![moeinkh88](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/moeinkh88/32/29607_2.png) [@moeinkh88](https://discourse.julialang.org/u/moeinkh88)\
**Post date:** [October 6, 2021, 2:20pm UTC](https://discourse.julialang.org/t/fft-x-n-when-n-length-x/69308/1 "2021-10-06T14:20:30Z")

</div>

I am trying to extract the n-point DFT of using fft for vector X. I am a MATLAB user, so, I run fft(X,n) when length(X)=16 and n=32. But it doesn’t work since fft in FFTW Pkg is limited to the length of vector X. Is there a way to get a vector with greater length by using fft?

---

<div class="post-metadata">

**Author:** ![stillyslalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stillyslalom/32/45687_2.png) [@stillyslalom](https://discourse.julialang.org/u/stillyslalom)\
**Post date:** [October 6, 2021, 2:46pm UTC](https://discourse.julialang.org/t/fft-x-n-when-n-length-x/69308/2 "2021-10-06T14:46:10Z")

</div>

See this related discussion: [How to set the length of fft](https://discourse.julialang.org/t/how-to-set-the-length-of-fft/38885)

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [October 6, 2021, 2:46pm UTC](https://discourse.julialang.org/t/fft-x-n-when-n-length-x/69308/3 "2021-10-06T14:46:44Z")

</div>

Just pad `X` with zeros to get to length `n`.

---

<div class="post-metadata">

**Author:** ![moeinkh88](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/moeinkh88/32/29607_2.png) [@moeinkh88](https://discourse.julialang.org/u/moeinkh88)\
**Post date:** [October 6, 2021, 3:14pm UTC](https://discourse.julialang.org/t/fft-x-n-when-n-length-x/69308/5 "2021-10-06T15:14:55Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![moeinkh88](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/moeinkh88/32/29607_2.png) [@moeinkh88](https://discourse.julialang.org/u/moeinkh88)\
**Post date:** [October 6, 2021, 3:15pm UTC](https://discourse.julialang.org/t/fft-x-n-when-n-length-x/69308/6 "2021-10-06T15:15:22Z")

</div>

Yes, it works:)
