octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #43673] fft() gives incorrect result for 3-dim


From: count
Subject: [Octave-bug-tracker] [bug #43673] fft() gives incorrect result for 3-dim array with singleton 3rd dimension
Date: Sun, 27 Nov 2016 06:40:20 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0

Follow-up Comment #14, bug #43673 (project octave):

This bug is not fully solved.

In fft (X, N, DIM), when DIM > ndims (X), fft should still produce reasonable
result instead of casting an error.

For example:


> fft(1, 3, 3)
error: fft: DIM must be a valid dimension along which to perform FFT


Expected result:


ans =

ans(:,:,1) =  1
ans(:,:,2) =  1
ans(:,:,3) =  1


In general (when DIM > ndims (X)), the answer is repmat (X, [ones(1,DIM-1)
N]). Which can be understood as 1-padding to dimensions of X to DIM, then 0
padding or truncation X to length N in dimension DIM, then do usual fft.

I have gave the use case in comment #3. And this extension conform to the
behaviour of MATLAB also.

I attatched a new patch. The fix works by 1-padding dimension of X to DIM.

(file #39079)
    _______________________________________________________

Additional Item Attachment:

File name: bug_43673_v2.patch             Size:2 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?43673>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]