plotting max and min of polynomial

16 views (last 30 days)
Mohammed Almalki
Mohammed Almalki on 18 Oct 2020
Answered: Shubham Rawat on 27 Oct 2020
how can I find the maximum and minimum (if any) of the polynomial f(x)= x^3-x^2-3x. plot the function and the max and min (if any) using 'o' for each min and '' for each max?? Thanks in advance!!
  2 Comments
Steven Lord
Steven Lord on 18 Oct 2020
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
Mohammed Almalki
Mohammed Almalki on 19 Oct 2020
I have deficulty in plotting the using 'o' for each min and '' for each max. I did plot the function however, i dont know how to make 'o' for each min and '*' for each max as per the question.

Sign in to comment.

Answers (1)

Shubham Rawat
Shubham Rawat on 27 Oct 2020
Hello Mohammed Almalki,
As you have mentioned in the comment you may have found extrema points of this function. Now you can Identify the extrema which one is minima and which one is maxima .Then you may use this function to plot Minima marked as 'o' and Maxima marked as '*'.
fplot(f) % where f = x^3-x^2-3x
hold on
plot(extrema(1), subs(f,extrema(1)), 'o') % extrema(1) is minima
plot(extrema(2), subs(f,extrema(2)), '*') % extrema(2) is maxima
hold off
For further reference you may use this document page

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!