Question: Combine multiple functions to one piecewise function

I have a function yp(x) made up of the sum of N functions yi(x) defined on subregions. For N = 3

yp := piecewise(x > 0 and x<=x1, y1(x),  x > x1  and x<=x2, y2(x) ,  x > x2  and x<=x3, y3(x));

The cordinates x1, x2,... and the functions y1, y2,... are calculated in a particular run and N can be large and varies from run to run. Hence explicitly writing yp as above is not possible.

Is there a way to define yp using an automatic loop construct?

Thanks.

 

Please Wait...