Skip to main content
1-Visitor
September 24, 2021
Solved

Mathcad Prime 6.0.0 Problem with Range Variable in Trigonometric Function

  • September 24, 2021
  • 2 replies
  • 2110 views

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.

Best answer by ttokoro

image.pngimage.png

2 replies

ttokoro
21-Topaz I
ttokoro21-Topaz IAnswer
21-Topaz I
September 24, 2021

image.pngimage.png

t.t.
1-Visitor
September 24, 2021

Thanks.

25-Diamond I
September 24, 2021

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