fplot graph error getting y=0
Show older comments
Im creating a graph for a simple function, but instead im getting a line at y=0 plotted. My range needs to be [-4,8] but it seems that when I type negative numbers in my range is when this error occurs. If I make the range [0,8] the graph appears normal but as soon as i change it to even [-1,8] I get just a line at y=0.
Additionally, when I open the figure in a seperate figure window it shows the proper graph, but in the graph that actually appears in the live script it is still y=0. I have no idea why this is happening.
Here is my code:
math=@(x)0.6.*x.^3.*exp(-0.4./x)+1.5.*x.^2.*exp(-0.6.*x);
fplot(math,[-1,8])
xlabel('\bfx')
ylabel('\bfy')
title('y=0.6x^3e^{-0.4/x}+1.5x^2e^{-0.6x}')
%here is what I mean about it working for positive ranges
math=@(x)0.6.*x.^3.*exp(-0.4./x)+1.5.*x.^2.*exp(-0.6.*x);
fplot(math,[0,8])
xlabel('\bfx')
ylabel('\bfy')
title('y=0.6x^3e^{-0.4/x}+1.5x^2e^{-0.6x}')
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

