How to Find the Maximum of a Function in MATLAB?

  • Thread starter Black-Mind
  • Start date
  • Tags
    Maximum
In summary, the conversation discusses using MATLAB to find the value that makes the derivative of a function equal to zero in order to find its maximum. The process involves defining a variable, inputting the function, differentiating it, and using the findpeaks function. However, due to representing a continuous function with a discrete one, this method may not always yield accurate results.
  • #1
Black-Mind
7
0
I'm new on MATLAB and I need to find the value that make the derivative of a function = 0 in order to find the maximum of my function

I started by defining the variable T

>> syms T

Then I but my function

>> f=((((cos(T))^2+(sin(T)*cos(T)))^2)+3*(((sin(T))^2+(sin(T)*cos(T)))^2))^(0.5)

Then I diffrentiate the function with respect to T

>> diff(f,T)

But know i want to find the value that make my function equal to zero but I can't figure it out espically that I'm new on matlab

If anybody can help me I'll be thankfull
 
Physics news on Phys.org
  • #2
help findpeaks

http://www.mathworks.com/help/toolbox/signal/ref/findpeaks.htmlWhen you use MATLAB for this you are representing a continuous function by a discrete one. For this reason, the exact point of the extreema may not have been included in your data set. So - differentiating the function and looking for the points that are equal to zero will usually be unhelpful.
 
  • #3
Thanks that was very helpfull
 
Last edited by a moderator:

Related to How to Find the Maximum of a Function in MATLAB?

1. How do I determine the maximum value in a set of data?

To find the maximum value in a set of data, you can use the "max" function in most programming languages. This function takes in a list of numbers and returns the largest value in the list.

2. Can I find the maximum value without using a programming language?

Yes, you can also determine the maximum value by arranging the data in numerical order and selecting the last value in the list. This method may be more time-consuming and prone to errors for larger datasets.

3. Is there a way to find the maximum value in a spreadsheet?

Yes, most spreadsheet programs have a built-in function for finding the maximum value in a range of cells. In Microsoft Excel, this function is called "MAX" and can be found in the "Formulas" tab.

4. How does finding the maximum value help in data analysis?

Finding the maximum value is useful in data analysis as it allows you to identify the highest value in a dataset, which can provide insights into trends or outliers. It can also help in making decisions based on the data, such as determining the best performing product or identifying the highest revenue-generating customers.

5. Can I find the maximum value in a graph or chart?

Yes, you can visually determine the maximum value in a graph or chart by looking for the highest point on the plotted data. Some graphing software also have a feature that displays the maximum value on the graph.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
146
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
119
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
Back
Top