%% Sample an Uncertain Complex Matrix
% Create a ucomplexm with the name F, nominal value [1 2 3; 4 5 6], and weighting matrices WL = diag([.1.3]), WR = diag([.4 .8 1.2]).

F = ucomplexm('F',[1 2 3;4 5 6],'WL',diag([.1 .3]),... 
   'WR',diag([.4 .8 1.2]))

%
% Sample the difference between the uncertain matrix and its nominal value at 80 points, yielding a 2-by-3-by-80 matrix typicaldev.

typicaldev = usample(F - F.NominalValue,80);

%
% Plot histograms of the deviations in the (1,1) entry and the (2,3) entry of the complex matrix.
% The absolute values of the (1,1) entry and the (2,3) entry are shown by histogram plots. Typical deviations in the (1,1) entry should be about 10 times smaller than the typical deviations in the (2,3) entry.

subplot(2,1,1); 
td11 = squeeze(typicaldev(1,1,:));
hist(abs(td11));
xlim([0 .25]) 
title('Sampled  F(1,1) - F(1,1).NominalValue') 
subplot(2,1,2); 
td23 = squeeze(typicaldev(2,3,:));
hist(abs(td23));
title('Sampled  F(2,3) - F(2,3).NominalValue')

% Copyright 2015 The MathWorks, Inc.