Main Content

문제 기반 접근법을 사용하여 비선형 다항 연립방정식 풀기

x가 2×2 행렬인 경우 다음 방정식

x3=[1234]

는 다항 연립방정식입니다. 여기서 x3은 행렬 곱셈을 이용한 x*x*x를 의미합니다. 문제 기반 접근법을 사용하여 이 연립방정식을 쉽게 정식화하고 풀 수 있습니다.

먼저, 변수 x를 2×2 행렬 변수로 정의합니다.

x = optimvar('x',2,2);

x에 대해 풀려는 방정식을 정의합니다.

eqn = x^3 == [1 2;3 4];

이 방정식으로 방정식 문제를 만듭니다.

prob = eqnproblem('Equations',eqn);

[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: [2x2 double]

해를 검토합니다.

disp(sol.x)
   -0.1291    0.8602
    1.2903    1.1612

해의 세제곱을 표시합니다.

sol.x^3
ans = 2×2

    1.0000    2.0000
    3.0000    4.0000

참고 항목

관련 항목