MATLAB: How to get this graph to plot correctly

functiongraphplot

f(x) = x^8 − 5x^4 + e^x − 7
I've tried f=@(x)x.^8 – 5*x.^4 + exp(x) – 7; and setting x = [-5:0.1:5]; and then just using the plot function, but it doesnt seem right…

Best Answer

This works for me:
f=@(x)x.^8 - 5*x.^4 + exp(x) - 7;
x = [-5:0.1:5];
plot(x, f(x))
It is essentially your code. What ‘doesn’t seem right’ about the plot?