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.
Solved! Go to Solution.
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 [).
Of course you could use these two vectors now to plot one over the other
BTW, I would prefer adding the unit "deg" to theta right from the start!