×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Inserting units into a range variable2

## Inserting units into a range variable

(OP)

I am trying to calculate a cylinder's mass as both diameter and length change.

I have defined the density as rho:= 7900 kg m-3 by using Insert, Unit from the toolbar.

I have defined i:=1..8 and j:=1..9.

I have defined the diameter and length as range variables:

d[i:=0.020, 0.022, 0.025, 0.030, 0.040, 0.050, 0.075, 0.100

len[j:=0.002, 0.004, 0.007, 0.012, 0.020, 0.030, 0.050, 0.075, 0.100

I have defined mass[i,j:= π/4*d[i2*rho*len[j

The calculation provides a matrix of i rows and j columns with the correct numbers, but the units are kg/m3 because d and len do not have units assigned.  I tried to insert the units in the defining equations and the mass equation, but I don't seem to know the proper syntax.

All help is appreciated.

Regards,

Cory

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips Fora.

### RE: Inserting units into a range variable

Cory,

A couple of possibilities ....

1.  define the units with each entry i.e. 0.02m,0.022m, etc
2.  after you have set up d and len, try multiplying by the units i.e.  d:= d*m.  Then each value of d will have the unit m.
3.  I usually set these up in a matrix and multiply the matrix by the units.

Good Luck

rd78

### RE: Inserting units into a range variable

Alternately, you can also define the ancillary vectors and the assign the units with something like:

d[i:d.unitless[i*m

TTFN

### RE: Inserting units into a range variable

(OP)
Thank you rd78 & IRstuff!

Regards,

Cory

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips Fora.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

#### Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a partâ€™s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!