fplot giving a different graph than my graphing calculator
8 views (last 30 days)
Show older comments
I am trying to graph a function in order to apply a Golden Section Search on it. However, fplot in matlab gives a completely different graph of the function than the same function graphed on my graphing calculator. The graph looks the exact same no matter what graphing tool I use (Desmos, Geogebra, etc), but in MatLab, it looks completely different. The function does not seem to be wrong since it calculates the right value for my input, so I am not sure what is wrong.
h=@(x)(12.6915*exp(0.5*x)-6.3).^2;
fplot(h)
I am pretty new to MatLab so I am not sure if I am plotting this right. I am just clueless as to why the graphs are so different.
Edit: When I plot the function on an iterval of [-2,-1], it looks the plots on the graphing calculators. Is there anyway to fix it so it plots like this without defining an interval?
0 Comments
Accepted Answer
Voss
on 3 Apr 2022
You can specify an interval in fplot, like you said, or you can specify the x- and/or y-limits of the axes after the plot is made.
h=@(x)(12.6915*exp(0.5*x)-6.3).^2;
fplot(h);
xlim([-3 0]);
ylim([-1 3]);
0 Comments
More Answers (0)
See Also
Categories
Find more on Scatter Plots 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!