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. - 消息

#1 已发布: 2020/8/25 02:07:36
henry crun

henry crun

0个赞,共34个帖子。

组: 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 已发布: 2020/8/25 04:36:38
Alvaro

Alvaro

1,139个赞,共1,805个帖子。

组: User

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

Clipboard01.jpg

Best regards.
Alvaro.
2位用户喜欢此帖子
sergio 2020/8/25 05:13:00, Martin_B 2020/8/25 09:21:00
#3 已发布: 2020/8/25 08:00:33
henry crun

henry crun

0个赞,共34个帖子。

组: 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 已发布: 2020/8/25 08:13:01
Alvaro

Alvaro

1,139个赞,共1,805个帖子。

组: 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.
  • 有新帖
  • 无新帖