How to solve f'(x)=0?

37 views (last 30 days)
laros on 29 Nov 2022
Commented: Torsten on 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.
Ela Markovic
Ela Markovic on 29 Nov 2022
How about:
fun = @f; % function
x0start = 2; % initial point
x0 = fzero(fun,x0start);
function y = f(x)
y = 4*x+4;

Sign in to comment.

Answers (1)

Torsten on 29 Nov 2022
You want to find x symbolically or numerically ?
Numerically use "fzero".
Symbolically use "solve".
Torsten on 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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by