solve x^2=[2 3;4 5] in matlab

In Matlab, you can solve this by using the built-in function sqrtm() to get the square root of a matrix. Here's an example code to solve x^2 = [2 3; 4 5]:

main.m
% Define the matrix
A = [2 3; 4 5];

% Get the square root
x = sqrtm(A);
73 chars
6 lines

Note that the solution is not unique, since a matrix can have multiple square roots.

related categories

gistlibby LogSnag