A system with two degrees of freedom.
A system with two-degree freedom.
A rubber-band with four inches of stretch.
A rubber-band with four-inch stretch.
If the measurement element is singular (four-inch) it is an adjective that modifies the noun directly: four-inch stretch.
If the measurement element is a plural noun, (four inches), then it must be complemented by a prepositional phrase: four inches of stretch.
The second question is whether such a phrase is better before or after another noun which it modifies:
AFTER:
A robotic arm with two degrees of freedom.
A robotic arm with two-degree freedom.
BEFORE:
A two-degrees-of-freedom robotic arm.
A two-degree-freedom robotic arm.
It is better to place such a modifying phrase after the noun, connected to the noun using the preposition "with":
A robotic arm with two degrees of freedom.
A robotic arm with two-degree freedom.
In this usage, "with" means that the preceding noun-phrase ("a robotic arm") has the characteristic "two degrees of freedom".
A synonym for "with" in this usage would be having:
A robotic arm having two degrees of freedom.
A robotic arm having two-degree freedom.
In my opinion, "with" is simpler and therefore better than "having".