# Choosing the units for plotting

I´m new to using units in Mathematica. I have read other similar posts about this issue but I haven´t found an answer so far. My problem is simple: I want to plot a certain function with a certain unit. In my case, I want a graphic in Angle - mm.

I have this function depending on a.

f[a_]:=(1 - Cos[0.017 a])*(Quantity[45.2,"Millimeters"]) +
(Quantity[145., "Millimeters"])*(1-Sqrt[1 - 0.097 Sin[0.017 a]^2])


When I plot it using

Plot[Evaluate[f[a]], {a, 0, 720}]


I get a results which is 1/1000 times the correct one (which should be in mm), so I assume that it is being shown in m. But in general, there is no way to know in which unit the graphic is being shown.

Or is there a way to do this? Thank you for the help.

-

With one change on the function: move the (1-COS[]), (1-Sin[]) parts inside the respective Quantity, this is how I handle Units:

f = Function[\[Theta],
Evaluate[QuantityMagnitude[
UnitConvert[(Quantity[(1 - Cos[(\[Pi] \[Theta])/180]) 45.2,
"Millimeters"]) + (Quantity[(1 -
Sqrt[1 - 0.0971719 Sin[(\[Pi] \[Theta])/180]^2]) 145,
"Millimeters"]), "Millimeters"]]]]


Essentially -- convert everything using UnitConvert into the units you want, and then take a magnitude. Not the prettiest, but it works.

Note that the described change is necessary for the Function` definition to properly evaluate.

-
Thank you @tkott , you have given me the idea to steer myself in the right direction. To sum up for anyone who might use this: First I get the desired unit using UnitConvert. Then, with QuantityMagnitude I can get a unitless function with the correct values that I can plot. – MBenedetto Feb 11 '14 at 17:47