Question: piecewise function and integral

Dear all 
I have a function defined over the closed interval [ x[k], x[k+2] ] and zero elsewhere 
I would like to plot this sequence of function and compute an integral. 

I need your help to finish the attahced code, something is wrong. I can't  use piecewise funciton in loop and plot all functions in the same graph

piecewise_funciton_and_integral.mw

thanks for your remaks and help

Please Wait...