# Find roots of quadratic matrix polyunomial

2 views (last 30 days)
Andrea Baleani on 13 Jul 2023
Answered: Malay Agarwal on 13 Jul 2023
I'd like to solve the following equation where are square complex matrices.

Malay Agarwal on 13 Jul 2023
Please try the following code. This uses the fsolve function to solve the equation numerically.:
% Define the matrix A as a complex matrix
A = complex(randn(5,5), randn(5,5));
% Define the equation function handle
eq = @(X) A*X^2 + X + A;
% Define the initial guess for X
x0 = complex(randn(5, 5), randn(5, 5));
% Solve the equation for X using fsolve
X_solution = fsolve(eq, x0);
Solver stopped prematurely. fsolve stopped because it exceeded the function evaluation limit, options.MaxFunctionEvaluations = 2.500000e+03.
% Display the solution for X
disp('Solution for X:');
Solution for X:
disp(X_solution);
10.4364 -14.8118i -0.6416 -10.9103i 9.4393 + 6.4624i 0.8966 + 5.5707i -1.4579 +11.0934i -6.2341 -22.7503i -18.8040 + 8.5239i 25.2421 -21.1322i -20.1716 + 8.5526i -1.6253 + 6.1362i 20.2211 - 1.4709i -21.2125 + 7.0483i 35.1446 + 2.8148i -45.9995 -20.6433i -21.7074 -13.8708i 23.3683 - 2.0332i -13.0695 +15.8339i 30.7822 - 5.9025i -54.1409 - 4.7549i -30.4751 - 7.9421i -2.9071 -10.0220i -1.5065 -36.7388i -4.2081 +29.9107i 46.4775 -17.6436i 27.6587 + 6.8325i