plotting max and min of polynomial

조회 수: 15 (최근 30일)
Mohammed Almalki
Mohammed Almalki 2020년 10월 18일
답변: Shubham Rawat 2020년 10월 27일
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에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by