%% Decompose Uncertain Matrix
% Create an uncertain matrix A with uncertain parameters p1, and p2. Decompose A into its certain part, M, and normalized uncertain part, Delta.

p1 = ureal('p1',-3,'perc',40); 
p2 = ucomplex('p2',2); 
A = [p1 p1+p2;1 p2]; 
[M,Delta] = lftdata(A); 

% You can inspect the difference between the original uncertain matrix, A, and the result formed by combining the two results from the decomposition.

simplify(A-lft(Delta,M)) 
M

% You can check the worst-case norm of the uncertain part using wcnorm. Compare samples of the uncertain part A with the uncertain matrix A.

wcn = wcnorm(Delta) 
usample(Delta,3) 

%
% Copyright 2019 The MathWorks, Inc.