plotting max and min of polynomial

24 visualizaciones (últimos 30 días)
Mohammed Almalki
Mohammed Almalki el 18 de Oct. de 2020
Respondida: Shubham Rawat el 27 de Oct. de 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 comentarios
Steven Lord
Steven Lord el 18 de Oct. de 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 el 19 de Oct. de 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.

Iniciar sesión para comentar.

Respuestas (1)

Shubham Rawat
Shubham Rawat el 27 de Oct. de 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!

Translated by