Solve Nonlinear System of Polynomials, Problem-Based - MATLAB & Simulink (original) (raw)
Main Content
When x
is a 2-by-2 matrix, the equation
x3=[1234]
is a system of polynomial equations. Here, x3 means x*x*x using matrix multiplication. You can easily formulate and solve this system using the problem-based approach.
First, define the variable x
as a 2-by-2 matrix variable.
Define the equation to be solved in terms of x
.
Create an equation problem with this equation.
prob = eqnproblem('Equations',eqn);
Solve the problem starting from the point [1 1;1 1]
.
x0.x = ones(2); sol = solve(prob,x0)
Solving problem using fsolve.
Equation solved.
fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
sol = struct with fields: x: [2×2 double]
Examine the solution.
-0.1291 0.8602 1.2903 1.1612
Display the cube of the solution.
ans = 2×2
1.0000 2.0000
3.0000 4.0000