I need to find values of a piece wise linear function. I used nested if condition as shown in code. But for all values of t, it is executing only first "if else" loop, and giving always x1d(t)= 0.5 andx2d(t)= 0.5 as output values. Am not able to figure out the mistake. help me.
for t = 1:1:26
if 0<t<=4 x1d(t) = 0.5*t; x2d(t) = 0.5*t; elseif 4<t<=7 x1d(t) = 0.5*t; x2d(t) = 3.33; elseif 7<t<=10 x1d(t) = 0.5*t; x2d(t) = 10/3 - 0.5*(t-40/3); elseif 10<t<=26 x1d(t) = 0.5*t; x2d(t) = 0; endend
Best Answer