So I have done a piece of code that is supposed to make two equal graphics, just by using different methods to do so. However, end result doesnt seem to go as planned. Can anyone see what is wrong here? How can I fix it?
x = -pi : pi/500 : pi;for i = -pi:pi/500:pi if (x > 0) y = sin(x).^2 + (1+x)./(1+exp(x)); else y = (1+x.^2).^(1.0/3.0); endendfigureplot(x,y);grid on; hold on;y = ((1+x.^2).^(1.0/3.0)).*(x<=0) + (sin(x).^2 + (1+x)./(1+exp(x))).*(x>0);plot(x,y);
Best Answer