如何提取非线性方程中的系数?。

最近想要实现对任意带非线性约束的非线性方程的极值,需要把任意已知维数的非线性方程的系数提取出来,请问有什么解决的办法吗?
例如一个简单的二元非线性方程:x+y+xy-2=0,我想要得到的是矩阵[ -2 1 1 1 ],即常数,对x求偏导数的常数部分,对y求偏导数的常数部分和对xy求导数的部分。

 Respuesta aceptada

baeving
baeving el 28 de Oct. de 2022

0 votos

syms x y
ff=x+y+x*y-2
coeffs(ff)

Más respuestas (0)

Etiquetas

Preguntada:

el 28 de Oct. de 2022

Respondida:

el 28 de Oct. de 2022

Community Treasure Hunt

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

Start Hunting!