How to solve f'(x)=0?

47 visualizzazioni (ultimi 30 giorni)
laros
laros il 29 Nov 2022
Commentato: Torsten il 30 Nov 2022
I want to find f'(x)=0
My function is f(x)=2x^2+4x. Then in MATLAB I wrote f2=diff(f);
Next step is to calculate f'(x)=0, but I do not know how. I tried a few examples I found with fzero() but it did not work.
Thanks!
  3 Commenti
laros
laros il 29 Nov 2022
I want to find the answer numerically. The question you posted is about value of x, I already figure that out. But I'm now trying to figure out how to solve f'(x)=0.(not symbolically).
Ela Markovic
Ela Markovic il 29 Nov 2022
How about:
fun = @f; % function
x0start = 2; % initial point
x0 = fzero(fun,x0start);
disp(x0)
-1
function y = f(x)
y = 4*x+4;
end

Accedi per commentare.

Risposte (1)

Torsten
Torsten il 29 Nov 2022
You want to find x symbolically or numerically ?
Numerically use "fzero".
Symbolically use "solve".
  5 Commenti
Jawad
Jawad il 30 Nov 2022
what does it do
Torsten
Torsten il 30 Nov 2022
You must supply a value where "fzero" starts searching for a solution of f'(x) = 0. I chose x0 = 2. You may choose another value if you like.

Accedi per commentare.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by