Start a topic
With the exception of Windchill, The PTC Community is on read-only status until April 6 in preparation for moving our community to a new platform. Learn more here
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The PTC Community is on temporary read only status in preparation for moving our community to a new platform. Learn more here

Translate the entire conversation x

Element-Wise Multiplication and Division with Column Vector Variables

thodij
6-Contributor

Element-Wise Multiplication and Division with Column Vector Variables

Hello PTC Community.

 

I am posting a Mathcad Prime 11.0.1.0 worksheet wherein I am evaluating certain quantities by performing element-wise multiplication and division of column vector variables. I believe that I am not doing this right.

Your help will be appreciated.

In MATLAB, it is .* & ./ for element-wise multiplication and division, respectively.

Both the attached Mathcad & Excel sheets work together.

 

Thank you for your assistance.

ACCEPTED SOLUTION

Accepted Solutions
ttokoro
21-Topaz I
(To:thodij)

Vectorization makes evry T  calculation. But nor sure what you want to do.

 

image.png

View solution in original post

12 REPLIES 12
ttokoro
21-Topaz I
(To:thodij)

Vectorization makes evry T  calculation. But nor sure what you want to do.

 

image.png

thodij
6-Contributor
(To:ttokoro)

Excellent! I can always count on my PTC community Brothers and Sisters to share their knowledge and take the time to provide feedback.

 

Thank you.

thodij
6-Contributor
(To:ttokoro)

Hi - How were you able to add the constant T = 277°C vertical line with the temperature marker?

thodij
6-Contributor
(To:thodij)

Hi - I was able to add the vertical marker, but could not figure out how to change the line style on the vertical marker!

thodij
6-Contributor
(To:thodij)

Hi, I got this vertical marker line style figured out ... it was in plain sight.

 

Only the QSL plot remains a mystery!

 

Thanks.

thodij
6-Contributor
(To:ttokoro)

Hello again -

 

Thanks for plotting these up.

For some reason, even after vectorization, my QSL variable is not evaluating and plotting as you have shown in your plot.

Any thoughts on that?

 

Thanks.

Werner_E
25-Diamond I
(To:thodij)

Actually QSL is evaluating and also plotting. The blue trace simply looks like its the x-axis because of a scaling problem.

Both QVL and QSL start in the hundreds of Watt, but QVL goes up to 4,8 * 10^8 W, while QSL just up to 2.2*10^5.

grafik.png

If you need both in the same plot you may limit the y-axis to something like 10^5

grafik.png

or you multiply the QSL values by, let's say, 10^3 which is the same as showing them in mW instead of W (which is what ttokoro had done 🙂 )

grafik.png

thodij
6-Contributor
(To:Werner_E)

Perfect. That makes sense.

 

Thanks again.

 

Have a good weekend!

Werner_E
25-Diamond I
(To:thodij)

As ttokoro already had shown, what you are looking for is called "vectorization" in Mathcad and Prime.>

B0.png

Vectorization is applied if you want a scalar calculation to be done with vectors element-wise. All involved vectors must have the same size and vectorization does not work recursively.

Prime applies vectorization automatically if the operation is not defined for vectors. So when v is a vector (in Prime only column vectors are considered vectors), Prime applies implicit vectorization if you type v2 but uses the scalar vector product when you use v*v.

Exponentiation (and likewise division) is not defined for vectors, so instead of issuing an error message, Prime automatically applies vectorization. While this is a convenient approach, it also means that, as in the example below for a*a/b, one might initially assume that the calculation is being performed element by element and continue to compute with incorrect results.

B1.png

 

thodij
6-Contributor
(To:Werner_E)

Hi,

 

Now I wonder why the expressions for ge, QBL, and QFL are grayed out!

See attached.

 

Thanks.

Werner_E
25-Diamond I
(To:thodij)


@thodij wrote:

Hi,

 

Now I wonder why the expressions for ge, QBL, and QFL are grayed out!

See attached.

 

Thanks.



Looks like you turned off automatic calculation and are in manual calculation mode. So when an expression is edited, the sheet does not update automatically but the edited region and all regions depending on it are greyed out to indicate that they may not show the correct current value.

Once you recalculate the sheet or turn auto calculation on again the regions should update.

 

thodij
6-Contributor
(To:Werner_E)

Thank you Sir. It is much appreciated.

 

Have a great week.

 

Regards,

thodij

Announcements


Top Tags