Applying a negative to the function to find the maximum
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Gavin Seddon
am 20 Aug. 2015
Beantwortet: siscovic
am 11 Nov. 2017
hello to find the maximum point in a curve I must use the negative function however this creates errors. My function is f = @(x)p1*x^4 + p2*x^3 + p3*x^2 + p4*x + p5 where does the minus sign precede the f? Thanks.
0 Kommentare
Akzeptierte Antwort
Titus Edelhofer
am 20 Aug. 2015
Hi,
your minus should span the entire function, i.e.
f = @(x) -(p1*x^4 + p2*x^3 + p3*x^2 + p4*x + p5);
Titus
0 Kommentare
Weitere Antworten (4)
Steven Lord
am 20 Aug. 2015
If you don't want to recreate the function handle as Titus suggested, create a new function handle that calls the existing function handle and negates that function's output:
minusF = @(x) -f(x);
0 Kommentare
siscovic
am 11 Nov. 2017
Hello, how to calculate the gradient, Hessian matrix, of this function.Thank you
f=@(x) (x(1)-2)^4+(x(1)-2)^2*x(2)^2+(x(2)+1)^2
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!