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

## Matrix calculation with trig functions not calculating correctly  3-Visitor

## Matrix calculation with trig functions not calculating correctly

Tring to use a matrix to calculate velocity with 360 degrees, manual angle setting gives the correct velocities but the matrix does not give the same values and they change depending on the size of the matrix. I have tried several things to get it to work but no luck.

1 ACCEPTED SOLUTION

Accepted Solutions  24-Ruby V
(To:reberhardt)
• There is no need to vectorize the output of the Excel component - it will be a vector anyway.
• There is no need to use Excel juts to create a vector with equally spaced values.

Guess that the help files and other docs still have a lot of information ready for you to find out 😉

I am surprised that the yellow result in your screenshot is a single scalar and not a vector!?

Here are four possible ways to create the vector you need in Mathcad without typing in every value manually: BTW - if the question is answered you should close the thread

4 REPLIES 4  23-Emerald II
(To:reberhardt)

Your sheet is somewhat complex, it is hard to understand what you're trying to do. Nothing appears obviously wrong.

Please indicate where unexpected results show up.

Luc  24-Ruby V
(To:reberhardt)

Working with vectors is not the preferred way to doit.

The first discrepancy I notice at Z.Pi The reason is as follows: The violet expression results in a vector and the green expression results in a vector, too. The product of two vectors is interpreted as a scalar product and the result is a single scalar. Not what you intend. If you want Prime to do the calculation singly for each element of the vectors, you have to tell it so. The operator to use is vectorization (the arrow over an expression).

Here you see the difference: What happens if you calculate sin(vector) or vector^2. These are operations not defined for vectors and Prime could (should?) throw an error. Instead Prime applies automatic vectorization without you noticing it.

Thats the reason why some of your calculations give the correct result even with vectors and some do not.

So its a good habit to use explicit vectorization in any case. As you can see - with vectorization you get the result you expect: Nevertheless I think a better approach would be to set up the calculations as functions which are at least dependent on theta (if not additionally on the other variables).

That way you can call later any of those function either with single values or with vectors (you will have to vectorize the function call of course). I am talking about something like this:   3-Visitor
(To:Werner_E) That was a great explanation and was very helpful! I am new to Mathcad and that does not come up in the tutorials. I went a slightly different way just because of the number of degrees I wanted to capture and insert an excel sheet and converted the output to a vector. now it is working flawlessly, thanks for the help, it is much appreciated.   24-Ruby V
(To:reberhardt)
• There is no need to vectorize the output of the Excel component - it will be a vector anyway.
• There is no need to use Excel juts to create a vector with equally spaced values.

Guess that the help files and other docs still have a lot of information ready for you to find out 😉

I am surprised that the yellow result in your screenshot is a single scalar and not a vector!?

Here are four possible ways to create the vector you need in Mathcad without typing in every value manually: BTW - if the question is answered you should close the thread 