Your function is calling itself without approaching any convergance or something that will allow it to end. Therefore it will run forever and eventually out of memory (hence the error). Try splitting it up into a script and a function as so:
Script:
k=0;
for i= -5:.25:50
k = k+1;
t(k)=i;
v(k)=vPieceWise(t(k));
end
plot(t,v);
figure
plot(t,v);
hold on
Function:
function v = vPieceWise(t)
if (t < 0)
v = 0;
elseif (0 <= t)&&(8<=16)
v = -5*t+10*t.^2;
elseif (8<=16)&&(t<=16)
v = 624 - 3*t;
elseif (t<=16)&&(t<=26)
v = 12*(t-16).^2+36*t;
elseif (26<t)
v = 2136*exp(-0.1*(t-26));
end
Best Answer