www.gusucode.com > robust 案例源码程序 matlab代码 > robust/GridOverMultiDimensionalParameterSpacesExample.m
%% Grid Over Multi-Dimensional Parameter Spaces % This example illustrates the different options in gridding % high-dimensional (e.g., |n| greater than 2) parameter spaces. %% % Construct an uncertain matrix, |m|, from four uncertain real parameters, % |a|, |b|, |c|, and |d|, each making up the individual entries in |m|. % Copyright 2015 The MathWorks, Inc. a = ureal('a',1); b = ureal('b',2); c = ureal('c',3); d = ureal('d',4); m = [a b;c d]; %% % First, grid the |(a,b)| space at five % places, and the |(c,d)| space at three places. m1 = gridureal(m,{'a';'b'},5,{'c';'d'},3); %% % |gridureal| evaluates the uncertain matrix |m| at these 15 % grid points, resulting in the numerical matrix |m1|. %% % Next, grid the |(a,b,c,d)| space % at 15 places. m2 = gridureal(m,{'a';'b';'c';'d'},15); %% % |gridureal| samples the uncertain matrix |m| % at these 15 points, resulting in the numerical matrix |m2|. %% % The (2,1) entry of |m| is just the uncertain real % parameter |c|. Plot the histograms % of the (2,1) entry of both |m1| and |m2|. % The (2,1) entry of |m1| only takes on three distinct % values, while the (2,1) entry of |m2| % takes on 15 distinct values uniformly through its range. subplot(2,1,1) hist(squeeze(m1(2,1,:))) title('2,1 entry of m1') subplot(2,1,2) hist(squeeze(m2(2,1,:))) title('2,1 entry of m2')