Gradient of polynomial and apply points

2 次查看(过去 30 天)
Hi everyone,
First of all, I have this polynomial (symbolic):
PF = 0.56057*x1^4 - 2.3567*x1^3*x3 + 7.7971*x1^3*x4 - 10.544*x1^3 - 1.5171*x1^2*x3^2 - 4.5825*x1^2*x3*x4 + 5.1824*x1^2*x3 + 11.583*x1^2*x4^2 - 30.391*x1^2*x4 + 28.869*x1^2 + 0.87025*x1*x3^3 - 3.9352*x1*x3^2*x4 + 5.6176*x1*x3^2 - 1.2696*x1*x3*x4^2 + 1.3133*x1*x3*x4 + 0.23756*x1*x3 + 5.2212*x1*x4^3 - 19.615*x1*x4^2 + 31.103*x1*x4 - 18.59*x1 + 0.37366*x3^4 + 0.33446*x3^3 - 1.0902*x3^2*x4^2 + 2.6402*x3^2*x4 - 1.7305*x3^2 - 0.48794*x3*x4^2 + 1.1816*x3*x4 - 0.80798*x3 + 0.72325*x4^4 - 3.503*x4^3 + 8.1821*x4^2 - 9.5425*x4 + 2.6176
I want to generate the gradient of this polynomial, and then apply some points on this gradient, for example, the points are:
x1 x2 x3 x4
1 0.638 1.710422667 2.00712864
1 0.55225 1.396263402 1.710422667
1 0.44475 1.151917306 1.483529864
1 0.40205 0.951204442 1.3543755
1 0.341825 0.865683309 1.258382391
1 0.33075 0.942477796 1.291543646
Where the first column corresponds to variable x1, the second column to x2, and so on… Then I want to store the results in a vector.
I have tried using the function gradient(PF), but it is returning a 3 line matrix, so I presumed something is wrong, as PF is a 4 variable function.
Can anyone help me doing this gradient and then apply those points? If the application of points can be generic it will be better to me, because I have more points than I showed here.
Eventually I will have to do this same process for much larger polynomials and apply more points. So this computational processing should be as light as it can be.
  1 个评论
Bryan Ambrósio
Bryan Ambrósio 2021-4-28
Just now i noticed that there is not variable x2 on this particular PF. So i have to apply only the points x1, x3 and x4 on the gradient.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Polynomials 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by