www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/MatrixSquarerootOfDifferenceOperatorExample.m

    %% Matrix Squareroot of Difference Operator
% Create a matrix representation of the fourth difference operator, |A|.
% This matrix is symmetric and positive definite.

% Copyright 2015 The MathWorks, Inc.

A = [5 -4 1 0 0; -4 6 -4 1 0; 1 -4 6 -4 1; 0 1 -4 6 -4; 0 0 1 -4 6]

%%
% Calculate the unique positive definite square root of |A| using |sqrtm|.
% |X| is the matrix representation of the second difference operator.
X = round(sqrtm(A))