When i go to run this code, it just keeps telling me to 'Enter a Value:' and will not show me any plot. I understand that this is my input, but i just want it to plot the values of x for (-10:10). Am i using the right commands?
function output=myfun(x)
x=input('Enter a Value:');
if x<-2
output=-x.^2;
elseif (-2<=x)&&(x<0)
output=-2.*x;
elseif (0<=x)&&(x<=2) output=2.*x;
elseif x>2
output=x.^2;
end
fplot(myfun(-10:10),output)
xlabel('x(m)')
ylabel('f(x)')
Best Answer