plotting max and min of polynomial

25 次查看(过去 30 天)
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 个评论
Steven Lord
Steven Lord 2020-10-18
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 2020-10-19
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.

请先登录,再进行评论。

回答(1 个)

Shubham Rawat
Shubham Rawat 2020-10-27
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

类别

Help CenterFile Exchange 中查找有关 Polynomials 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by