Question: Piecewise function with substitutions

Is this a correct way to define a piecewise function in which substitution occurs, or are there better ones?

Data := [L=1000, F=1000, E=206000, d0=10];

Diameters := X -> eval(subs(Data, piecewise(x<L/2, d0 ,x<2/3*L, 2*d0 ,x>2/3*L, 1.5*d0)), x=X); 
 

Please Wait...