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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Mathcad Prime 6.0.0 Problem with Range Variable in Trigonometric Function

BW_9370051
3-Visitor

Mathcad Prime 6.0.0 Problem with Range Variable in Trigonometric Function

When I evaluate a range variable in a trigonometric function it works fine. But the problem comes in when I assign this trigonometric function containing the range variable to another variable. I get an error on the range variable that says, "This value must be a scalar or a matrix." The sheet is attached.

1 ACCEPTED SOLUTION

Accepted Solutions
ttokoro
20-Turquoise
(To:BW_9370051)

3 REPLIES 3
ttokoro
20-Turquoise
(To:BW_9370051)

image.pngimage.png

Thanks.

You have to know that there in Mathcad there is a big difference between ranges and vectors and Prime does not make it easy to distinguish between the two as it displays both the very same way. But a range is not a series of values but rather some kind of an implicit loop. Thats the reason why assigning your expression to a variable fails.

If you really need discrete values you could do as shown below. First define a range (i) which is only used to index the elements of the vector (theta) which is defined next. theta is now a vector and not a range and so it can be used the way you tried. I used a stepwidth of 10 and to simulate your example, you would define i:=0..359 and theta[i:=i. Note that the index used when defining theta is NOT a literal index (the one you create with Ctrl -) but a vector/matrix index (which you create using [).

Werner_E_0-1632475852974.png

Of course you could use these two vectors now to plot one over the other

Werner_E_1-1632476004483.png

BTW, I would prefer adding the unit "deg" to theta right from the start!

Werner_E_2-1632476258703.png

 

 

Top Tags