Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
I'm trying to truncate a data sample to an even power of two for input to the FFT.
I define j := 0..128 (using colon and semicolon keyboard strokes)
And verify by printing j = to confirm that the definition is correct.
BUT,
when expressing Xsample [j := X[j, I get the error message that J must be an integer, and the help file response stating that the subscript j "seems to have a fractional part".
In a second attempt to define my subscript by writing out the definition explicitly, I get the same failure.
0
1
2
3
j = .
.
.
127
I''m pretty stuck here and will appreciate help.
Thanks
Bob
Please post your worksheet (and an image of what you're seeing). It's difficult to diagnose a worksheet, otherwise, as many errors aren't obvious from a description of what people "think" they've written (eg, array indices vs name subscripts).
Have you tried manually setting an index to, say, j:= 9, to check that your basic equation works?
Another couple of things to consider are using the function submatrix to pick out the values you want (note 0..128 will give you 129 values).
Or try the function cfft, which doesn't care about powers of two.
Stuart
Hello, BOB, perhaps the example shown in the following image, created on the basis of the indications of the mathcad's Help, can be very useful.
Cheers
FM
I'm trying to truncate a data sample to an even power of two for input to the FFT.
If you use CFFT or cfft you do not need the number of points to be a power of 2.
Regarding the error, as others have noted it's not possible to diagnose the problem without the worksheet.
> I define j := 0..128 (using colon and semicolon keyboard strokes)
You would get a vector with 129 data points that way!
> And verify by printing j = to confirm that the definition is correct.
Oh! Have you added the "=" to confirm in the very same region where you defined the range (inline evaluation)? If yes, delete the "=" and write j=.. in a separate region. Inline evaluation turns the range into a vector (undocumented feature) and vectors can' be used to index matrices/vectors, you must use ranges.
> In a second attempt to define my subscript by writing out the definition explicitly,
Guess that you defined a vector but you need a range (see above).
WE