How to evaluate an algebraic expression at a certain point when it is in a matrix?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Aravind Vissamsetty
am 14 Mär. 2021
Kommentiert: Aravind Vissamsetty
am 15 Mär. 2021
In the below expressions:
syms x1 x2 H f
xs = [1 1];
f = (12*x1^3 - 20*x1^3*x2^2 + 6*x2^2 + x1^2 +9);
H = hessian(f);
So the term H(1,1) would be a symbolic with a value (- 120*x1*x2^2 + 72*x1 + 2)
What is the simplest way to calculate the value of this expression at a point, say (x1,x2) = (1,2) ?
0 Kommentare
Akzeptierte Antwort
ANKUR KUMAR
am 15 Mär. 2021
You can use matlabFunction to create an anonymous function, which will eventually help to calcuate the values at specific x1 and x2.
syms x1 x2 H f
xs = [1 1];
f1 = (12*x1^3 - 20*x1^3*x2^2 + 6*x2^2 + x1^2 +9);
func=matlabFunction(hessian(f1));
func(1,2)
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!