Info
This question is closed. Reopen it to edit or answer.
Matlab code and function
10 views (last 30 days)
Show older comments
Could you please explain to me the following Queistions: If I have:
f(x)=-2x^2+Lx
Constraints x is in the feasible set [0,L/2] If the question is: give df/dx= -2x + L;
- write a function that numerically solves df/dx = -4x+ L=0
- how to solve df/dx = 0; directly use the solution x*=L/4.
- Finally how can I find max {f(0),f(x*),f(L/2)}
1 Comment
Image Analyst
on 28 Apr 2017
I cannot explain the difference between -2x + L and -4x+L unless it's just a typo you made. I suggest you ask your instructor.
Otherwise use linspace(0 to make up a vector of x values, and use the max() function. You might use inputdlg() to ask the user for the L value, and the starting and stopping value of x. http://www.mathworks.com/matlabcentral/answers/8626-how-do-i-get-help-on-homework-questions-on-matlab-answers
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!