Units not simplified in Matrices

Units not simplified in Matrices - Units are not simplified (i.e. to ohms etc) from the base SI units, when they are in matrices. - Messages

#1 Posted: 8/25/2020 2:07:36 AM
henry crun

henry crun

0 likes in 34 posts.

Group: User

Units are not simplified (i.e. to ohms etc) from the base SI units, when they are in matrices.
This means that I can't really use a vector to return tuples from a function or display numbers with mixed units, as the units become unrecognisable.

btw, is there an easy way to copy the smath region, and paste it into this?

Smath_Units_Matrices_Bug1.png

#2 Posted: 8/25/2020 4:36:38 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Hi. This is my workaround: in the unit placeholder put diag([unit1, unit2, unit3]^T)

Clipboard01.jpg

Best regards.
Alvaro.
2 users liked this post
sergio 8/25/2020 5:13:00 AM, Martin_B 8/25/2020 9:21:00 AM
#3 Posted: 8/25/2020 8:00:33 AM
henry crun

henry crun

0 likes in 34 posts.

Group: User

That's a very twisted solution!
Here's the catch: I want to return a tuple of two values where I don't know what the units will be.

I thought num2str() might be able to help me just return printable strings, but it also returns the expanded base units.
num2str(2.3ohm)="{23*'kg*'m^2}/{10*'A^2*'s^3}"
#4 Posted: 8/25/2020 8:13:01 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote

...
Here's the catch: I want to return a tuple of two values where I don't know what the units will be.
...



Hi. If you want the string with the value and the unit, try this: with this post ( https://en.smath.com/forum/yaf_postst17763_Dimensions-utility.aspx ) you can seek the dimensions of an unit, further, you can add a column in the 'Dimensions matrix with the unit as string for each one dimension and return it in some function UnitString, instead the dimension name.

Or can use this if don't want to work with strings:

Clipboard01.jpg

Best regards.
Alvaro.
  • New Posts New Posts
  • No New Posts No New Posts