cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Mathcad 15 rejects j:= 0..127 subscript as not being a set of integers

rphillips-2
1-Visitor

Mathcad 15 rejects j:= 0..127 subscript as not being a set of integers

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

4 REPLIES 4
StuartBruff
23-Emerald III
(To:rphillips-2)

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

-MFra-
21-Topaz II
(To:rphillips-2)

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

Signal sampling.jpg

RichardJ
19-Tanzanite
(To:rphillips-2)

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.

Werner_E
25-Diamond I
(To:rphillips-2)

> 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

Announcements

Top Tags