Applying a negative to the function to find the maximum
显示 更早的评论
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.
采纳的回答
更多回答(4 个)
Steven Lord
2015-8-20
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);
Azzi Abdelmalek
2015-8-20
0 个投票
f=@(x)p1*x^4+p2*x^3+p3*x^2+p4*x+p5 h=@(x)-f(x)
siscovic
2017-11-11
0 个投票
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
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!