why my graph not matching this graph?
Show older comments
ok so I'm assigned to match this graph. the problem looks straight forwards, but for some reason max and min are not spitting the right values for the highest point and lowest point of a function. why is this? they are spitting out the highest index and lowest index.
f = @(x) x.^3-6.*x;
x = linspace(-3,3,100);
[f0,i0] = min(f(x))
x0 = x(i0)
[f1,i1] = max(g)
x1 = x(i1)
figure
plot(x,f(x),'b-',x0,f0,'rs',x1,f1,'ro')
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D 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!