Message Boards Message Boards


Unreasonable error from Fourier

Posted 10 years ago
1 Reply
0 Total Likes

here is the command I typed. 
a = Fourier[{{ConstantArray[1, {4, 1}]}, {ConstantArray[     0, {12, 1}]}, {ConstantArray[1, {4, 1}]}}]

and get this error
Fourier::fftl: Argument {{{{1},{1},{1},{1}}},{{{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}}},{{{1},{1},{1},{1}}}} is not a non-empty list or rectangular array of numeric quantities.

is there anyway out of this? The documentation does not give a clue. 
What are you actually trying to compute the Fourier transform of?  The argument of Fourier must be a rectangular array (a matrix) or a list of numeric quantities.  The argument that you supplied to Fourier is neither of these.  Do you want your argument to be a simple list of 1s and 0s?  If that is the case then you must Flatten the argument as in
Fourier[Flatten[{{ConstantArray[1, {4, 1}]}, {ConstantArray[0, {12, 1}]}, {ConstantArray[1, {4, 1}]}}]]

The error messages are (often) quite informative, so read and reflect on them and look the examples over to get a sense of what may have gone wrong.  In your case you would get a quick sense of what's going wrong by examining the argument that you supplied to Fourier as in 
MatrixForm[{{ConstantArray[1, {4, 1}]}, {ConstantArray[
    0, {12, 1}]}, {ConstantArray[1, {4, 1}]}}]
POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract