Finding of arg max of a function using Gradient descent

2 Ansichten (letzte 30 Tage)
Let F=abs(a+bx)^2
Problem: Find x to get the maximum of F.
How to proceed with graident descent to solve this problem in matlab?
  2 Kommentare
John D'Errico
John D'Errico am 8 Jul. 2022
PLEASE STOP posting obvious homework assignments withg no effort made.
Murali Krishna AG
Murali Krishna AG am 8 Jul. 2022
This is not home work assignment. It's a part of my research work. I am posting after many attempts.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Sam Chak
Sam Chak am 8 Jul. 2022
I usually plot the graph if possible before attempting to solve a particular problem.
In your case, I'm unsure if you want to find the maximum or minimum of .
a = 1;
b = 1;
F = @(x) abs(a + b*x).^2;
x = linspace(-4, 2);
plot(x, F(x)), grid on, xlabel('x'), ylabel('F(x)')
  7 Kommentare
Sam Chak
Sam Chak am 8 Jul. 2022
Bearbeitet: Sam Chak am 8 Jul. 2022
@Murali Krishna AG, I'm actually no good at gradient descent method. But @John D'Errico is a mathematician and he is very good at solving optimization problems. Anyhow, I was trying to show you that no matter what values a and b are, the function is a parabola that opens upwards. That's why I plotted it out in the first place for you to realize it by yourself.
Usually, if the question not a homework, we don't put it like "Let this equation be ... something. Find/Solve ... using this method."
Instead, we put it like, "I'm solving this problem (show equation) with this MATLAB code:
% Type MATLAB code here:
fplot('abs(a + b*x).^2')
Error using fplot
Input must be a function or functions of a single variable.
and the Error message is shown above."
Murali Krishna AG
Murali Krishna AG am 8 Jul. 2022
Bearbeitet: Murali Krishna AG am 8 Jul. 2022
@Sam Chak Okay. Thank you very much. I will change my way of posting the questions.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by