%% Partial Decomposition
% Create an uncertain matrix A and derive an uncertain matrix B using an implicit-to-explicit conversion, imp2exp. Note that B has 2 uncertain parameters R and K. You can decompose B into certain part, M, and normalized uncertain part, Delta.

R = ureal('R',1,'Percentage',[-10 40]); 
K = ureal('K',2e-3,'Percentage',[-30 30]); 
A = [1 -R 0 -K;0 -K 1 0]; 
Yidx = [1 3]; 
Uidx = [4 2]; 
B = imp2exp(A,Yidx,Uidx); 
[M,Delta] = lftdata(B); 

% The same operation can be performed by defining the uncertain parameters, K and R, to be extracted.

[MK,DeltaR] = lftdata(B,'R'); 
MK 
[MR,DeltaK] = lftdata(B,'K'); 
MR 
simplify(B-lft(Delta,M)) 
simplify(B-lft(DeltaR,MK)) 
simplify(B-lft(DeltaK,MR)) 

% Examine the result formed by combining the two results from the decomposition.

[Mall,Deltaall] = lftdata(B,{'K';'R'}); 
Mall-M

%
% Copyright 2019 The MathWorks, Inc.