Can someone tell me what's wrong with this code? It is only plotting at x=6 because the loop obviously ends there.
e=2.718;
for x=-2:1:6
if x<-1 y=e.^(x+1) elseif x>=-1 && x<5 y=2+cos(pi.*x) elseif x>=5 y=10.*(x-5)+1 else fprintf('answer not given') endendx=-2:6;plot(x,y)
Thanks you
Best Answer