Skip to content
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.

Commit

Permalink
20160701
Browse files Browse the repository at this point in the history
- Editing Cemments in "doANOVAandPrediction", "doCompositeDesignAnalysis", and "doFullFactorialAnalysis"
- Enable "plotContour" for 3D Interpolation
-> Editing "labelPlots_23D" and "plotInterpolation_23D"
- Debug doConditionalSimulation_ResAlgInEq
-> Now also measurment noise is considered


Signed-off-by: Lazloo <[email protected]>
  • Loading branch information
Lazloo committed Jul 1, 2016
1 parent d51700a commit 8163606
Show file tree
Hide file tree
Showing 27 changed files with 223 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
--><title>tutorialVisualizingData</title><meta name="generator" content="MATLAB 8.6"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2016-05-18"><meta name="DC.source" content="tutorialVisualizingData.m"><style type="text/css">
--><title>tutorialVisualizingData</title><meta name="generator" content="MATLAB 9.0"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2016-07-01"><meta name="DC.source" content="tutorialVisualizingData.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
Expand Down Expand Up @@ -66,7 +66,7 @@



</style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#1">Tutorial: How to visualize data</a></li><li><a href="#2">Test Function</a></li><li><a href="#3">Initialization</a></li><li><a href="#4">2D - Interpolation Plots</a></li><li><a href="#6">3D Interpolation plots</a></li><li><a href="#8">Screening Plots</a></li><li><a href="#9">nD Interpolation plots</a></li><li><a href="#10">MakeMovie</a></li></ul></div><h2>Tutorial: How to visualize data<a name="1"></a></h2><pre class="codeinput">close <span class="string">all</span>
</style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#1">Tutorial: How to visualize data</a></li><li><a href="#2">Test Function</a></li><li><a href="#3">Initialization</a></li><li><a href="#4">2D - Interpolation Plots</a></li><li><a href="#6">3D Interpolation plots</a></li><li><a href="#8">Contour plots</a></li><li><a href="#10">Screening Plots</a></li><li><a href="#11">nD Interpolation plots</a></li><li><a href="#12">MakeMovie</a></li></ul></div><h2>Tutorial: How to visualize data<a name="1"></a></h2><pre class="codeinput">close <span class="string">all</span>
</pre><h2>Test Function<a name="2"></a></h2><p>The test function as follows:</p><p><img src="tutorialVisualizingData_eq06559173809755883972.png" alt="$$f_{\rm{Test}} = \frac{10x_{1}}{5 + x_{1}}\sin\left( x_{2} \right) +&#xA;x_{3}$$"></p><p>That is, the output is related to the first input variable by a Michaelis Menten curve(steep increase for small values followed by a plateau). The second input variable leads to oscillation and the third input variable leads to an linear monotonically increase. The effect of the first and second input are coupled with each other.</p><p>For a better visualization, pair-wise combination of input variables are plotted against the output. Remaining input variable was hold constant at the value of 2.</p><pre class="codeinput">visualizeTestFunction();
</pre><img vspace="5" hspace="5" src="tutorialVisualizingData_01.png" alt=""> <img vspace="5" hspace="5" src="tutorialVisualizingData_02.png" alt=""> <img vspace="5" hspace="5" src="tutorialVisualizingData_03.png" alt=""> <h2>Initialization<a name="3"></a></h2><p>Step 1: Create a new Kriging analysis object. For more details see documentation of <a href="matlab:open(fullfile('tutorialCreatingObject.html'))">tutorialCreatingObject</a></p><pre class="codeinput">[KrigingObj]=tutorialCreatingObject(false);

Expand Down Expand Up @@ -100,21 +100,40 @@
set(gca,<span class="string">'FontSize'</span>,10)
<span class="keyword">end</span>
KrigingObj.setShowBounds(true)
</pre><img vspace="5" hspace="5" src="tutorialVisualizingData_07.png" alt=""> <img vspace="5" hspace="5" src="tutorialVisualizingData_08.png" alt=""> <img vspace="5" hspace="5" src="tutorialVisualizingData_09.png" alt=""> <h2>Screening Plots<a name="8"></a></h2><p>Screening plots show interpolation for all pair-wise combinations of input variables. The remaining input variables are set fix to a predefined reference point.</p><pre class="codeinput">KrigingObj.setReferencePoint([2,2,2]); <span class="comment">% Values for remaining input variables</span>
</pre><img vspace="5" hspace="5" src="tutorialVisualizingData_07.png" alt=""> <img vspace="5" hspace="5" src="tutorialVisualizingData_08.png" alt=""> <img vspace="5" hspace="5" src="tutorialVisualizingData_09.png" alt=""> <h2>Contour plots<a name="8"></a></h2><p>Contour plots represent the top view of the 3D Interpolation. It projectes the 3D information to 2D and is often easier to interprete. Before a contour plot can be create the 3D information have to be calculated in the same fashion as for the 3D interpolation plots.</p><p>NOTE: Settings such as "ShowData" are global and are used also for several other visualization features</p><pre class="codeinput">combinations = [1,2,3;1,3,2;2,3,1]; <span class="comment">% Pair-wise combinations of input variables</span>
KrigingObj.setShowData(true) <span class="comment">% Show provided data points</span>

<span class="comment">% Set the inputs for "plotInterpolation_23D"</span>
dimension = 3;
showExpectedImprovement = false;
showContourplot = true;

<span class="keyword">for</span> iComb = 1:nInputVar
KrigingObj.calcInterpolation_3D(indexKrigingObj,<span class="keyword">...</span>
combinations(iComb,1:2),combinations(iComb,3),2)
KrigingObj.plotInterpolation_23D(indexKrigingObj,dimension,<span class="keyword">...</span>
showExpectedImprovement,showContourplot)
grid <span class="string">on</span>

<span class="comment">% Set format appropriate for documentation</span>
set(gcf,<span class="string">'Position'</span>, [100, 100, 330, 330/4*3]);
set(gca,<span class="string">'FontSize'</span>,10)
<span class="keyword">end</span>
</pre><img vspace="5" hspace="5" src="tutorialVisualizingData_10.png" alt=""> <img vspace="5" hspace="5" src="tutorialVisualizingData_11.png" alt=""> <img vspace="5" hspace="5" src="tutorialVisualizingData_12.png" alt=""> <h2>Screening Plots<a name="10"></a></h2><p>Screening plots show interpolation for all pair-wise combinations of input variables. The remaining input variables are set fix to a predefined reference point.</p><pre class="codeinput">KrigingObj.setReferencePoint([2,2,2]); <span class="comment">% Values for remaining input variables</span>
KrigingObj.calcScreeningAnalysis(indexKrigingObj)
KrigingObj.plotScreeningAnalysisKrigingInterpolation(indexKrigingObj)

<span class="comment">% Set format appropriate for documentation</span>
set(gcf,<span class="string">'Position'</span>, [100, 100, 700, 700/4*3]);
set(gca,<span class="string">'FontSize'</span>,10)
</pre><img vspace="5" hspace="5" src="tutorialVisualizingData_10.png" alt=""> <h2>nD Interpolation plots<a name="9"></a></h2><p>The idea of "n-D" is to use several contour plot showing the dependency of the output variable on two input variables while increasing a third one. This can be repeated for all combination of input variables leading to an overall understanding.</p><pre class="codeinput">KrigingObj.setnPlots(5); <span class="comment">% Number of columns in each row</span>
</pre><img vspace="5" hspace="5" src="tutorialVisualizingData_13.png" alt=""> <h2>nD Interpolation plots<a name="11"></a></h2><p>The idea of "n-D" is to use several contour plot showing the dependency of the output variable on two input variables while increasing a third one. This can be repeated for all combination of input variables leading to an overall understanding.</p><pre class="codeinput">KrigingObj.setnPlots(5); <span class="comment">% Number of columns in each row</span>
KrigingObj.calcInterpolation_nD(indexKrigingObj,[1,2,3;1,3,2;2,3,1],[],[]) <span class="comment">% no remaining input variables</span>
KrigingObj.plotInterpolation_nD(indexKrigingObj)

<span class="comment">% Set format appropriate for documentation</span>
set(gcf,<span class="string">'Position'</span>, [100, 100, 700, 700/4*3]);
set(gca,<span class="string">'FontSize'</span>,10)
</pre><img vspace="5" hspace="5" src="tutorialVisualizingData_11.png" alt=""> <h2>MakeMovie<a name="10"></a></h2><p>The movie analysis allows a dynamic visualization of three factor interaction. In the end, an avi file is produced with a user defined frame rate. In total, <i>n</i> 3D-interpolation plots are generared for the movie. The camera position has to be adjusted at the beginning and is hold fixed for the remaining recording.</p><p>Under Windows, the resulting movie can be opened <a href="matlab:winopen('movieAnalysis.avi')">here</a></p><pre class="codeinput">fileName = <span class="string">'movieAnalysis'</span>;
</pre><img vspace="5" hspace="5" src="tutorialVisualizingData_14.png" alt=""> <h2>MakeMovie<a name="12"></a></h2><p>The movie analysis allows a dynamic visualization of three factor interaction. In the end, an avi file is produced with a user defined frame rate. In total, <i>n</i> 3D-interpolation plots are generared for the movie. The camera position has to be adjusted at the beginning and is hold fixed for the remaining recording.</p><p>Under Windows, the resulting movie can be opened <a href="matlab:winopen('movieAnalysis.avi')">here</a></p><pre class="codeinput">fileName = <span class="string">'movieAnalysis'</span>;
KrigingObj.setFrameRate(2)
KrigingObj.setnStepsBetweenBounds(10)
KrigingObj.setReferencePoint([2,2,2]); <span class="comment">% Values for remaining input variables</span>
Expand All @@ -132,7 +151,7 @@
Step 8 of 10
Step 9 of 10
Step 10 of 10
</pre><p class="footer"><br><a href="http://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2015b</a><br></p></div><!--
</pre><p class="footer"><br><a href="http://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2016a</a><br></p></div><!--
##### SOURCE BEGIN #####
%% Tutorial: How to visualize data
%
Expand All @@ -158,7 +177,8 @@
%% Initialization
% Step 1: Create a new Kriging analysis object. For more details see
% documentation of <matlab:open(fullfile('tutorialCreatingObject.html')) tutorialCreatingObject>
% documentation of <matlab:open(fullfile('tutorialCreatingObject.html'))
% tutorialCreatingObject>
[KrigingObj]=tutorialCreatingObject(false);
% Remember the Currently used object
Expand Down Expand Up @@ -214,6 +234,34 @@
end
KrigingObj.setShowBounds(true)
%% Contour plots
% Contour plots represent the top view of the 3D Interpolation. It
% projectes the 3D information to 2D and is often easier to interprete.
% Before a contour plot can be create the 3D information have to be
% calculated in the same fashion as for the 3D interpolation plots.
%%%
% NOTE: Settings such as "ShowData" are global and are used also
% for several other visualization features
combinations = [1,2,3;1,3,2;2,3,1]; % Pair-wise combinations of input variables
KrigingObj.setShowData(true) % Show provided data points
% Set the inputs for "plotInterpolation_23D"
dimension = 3;
showExpectedImprovement = false;
showContourplot = true;
for iComb = 1:nInputVar
KrigingObj.calcInterpolation_3D(indexKrigingObj,...
combinations(iComb,1:2),combinations(iComb,3),2)
KrigingObj.plotInterpolation_23D(indexKrigingObj,dimension,...
showExpectedImprovement,showContourplot)
grid on
% Set format appropriate for documentation
set(gcf,'Position', [100, 100, 330, 330/4*3]);
set(gca,'FontSize',10)
end
%% Screening Plots
% Screening plots show interpolation for all pair-wise combinations of
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions Tutorial/ScriptsForDocu/tutorialVisualizingData.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,34 @@
end
KrigingObj.setShowBounds(true)

%% Contour plots
% Contour plots represent the top view of the 3D Interpolation. It
% projectes the 3D information to 2D and is often easier to interprete.
% Before a contour plot can be create the 3D information have to be
% calculated in the same fashion as for the 3D interpolation plots.
%%%
% NOTE: Settings such as "ShowData" are global and are used also
% for several other visualization features
combinations = [1,2,3;1,3,2;2,3,1]; % Pair-wise combinations of input variables
KrigingObj.setShowData(true) % Show provided data points

% Set the inputs for "plotInterpolation_23D"
dimension = 3;
showExpectedImprovement = false;
showContourplot = true;

for iComb = 1:nInputVar
KrigingObj.calcInterpolation_3D(indexKrigingObj,...
combinations(iComb,1:2),combinations(iComb,3),2)
KrigingObj.plotInterpolation_23D(indexKrigingObj,dimension,...
showExpectedImprovement,showContourplot)
grid on

% Set format appropriate for documentation
set(gcf,'Position', [100, 100, 330, 330/4*3]);
set(gca,'FontSize',10)
end


%% Screening Plots
% Screening plots show interpolation for all pair-wise combinations of
Expand Down
27 changes: 27 additions & 0 deletions dependencies/@AnalyzeKriging/doANOVAandPrediction.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
function [] = doANOVAandPrediction(obj,KrigingObjectIndex,X,inputMatrix,df)
% [] = doANOVAandPrediction(KrigingObjectIndex,ExpDesign,inputMatrix,df)
% Input:
% - KrigingObjectIndex ... index of Kriging object of interest
% - ExpDesign .. normalized experimental design [nPoints X nDesignVariables]
% - inputMatrix ... actual input values [nPoints X nInputVar]
% - df .. degree of freedom (nPoints - nDesignVariables)
%
% Design vairables represent a combination of input variables such as
% [x1],[x1*x2],[x2*x2] ...
%
% Output: -
%
% You can set:
%
% You can get:
% ANOVACoefficients ... contains the polynomial coefficient calculated during the
% ANOVA-Analysis
% ANOVACovMatrix ... Contain the covariance of the polynomial coefficient calculated
% during the ANOVA-Analysis
% ANOVAStdOfCoefficients ... contains the standard deviation of the polynomial coefficient
% calculated during the ANOVA-Analysis
% ANOVATvalue ... contain the t-value for t-test in order to decide which of the
% polynomial coefficient differ significantly from zero
% ANOVAPvalue ... Contain the p-value for t-test in order to decide which of the
% polynomial coefficient differ significantly from zero. Ususally
% values lower than 0.05 represent significant coefficients
%
% This Function does the main work of the ANOVA
% Copyright 2014-2016: Lars Freier, Eric von Lieres
% See the license note at the end of the file.
Expand Down
30 changes: 13 additions & 17 deletions dependencies/@AnalyzeKriging/doCompositeDesignAnalysis.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,22 @@
% [] = doCompositeDesignAnalysis(obj,KrigingObjectIndex)
% This function create a central composite design inside of the Kriging
% interpolation and applies afterwards an ANOVA.
% KrigingObjectIndex ... Index of the Kriging object on which the ANOVA
% should be applied.
% You can get:
% ANOVACoefficients ... contains the polynomial coefficient calculated during the
% ANOVA-Analysis
% ANOVACovMatrix ... Contain the covariance of the polynomial coefficient calculated
% during the ANOVA-Analysis
% ANOVAStdOfCoefficients ... contains the standard deviation of the polynomial coefficient
% calculated during the ANOVA-Analysis
% ANOVATvalue ... contain the t-value for t-test in order to decide which of the
% polynomial coefficient differ significantly from zero
% ANOVAPvalue ... Contain the p-value for t-test in order to decide which of the
% polynomial coefficient differ significantly from zero. Ususally
% values lower than 0.05 represent significant coefficients
%
% Input:
% - KrigingObjectIndex ... index of Kriging object of interest
%
% Output: -
%
% You can set:
% ShowDetails ... a table is display which contains the variable in the of
% "You can get"
% Be aware that all get variable are overwritten everytime you run an
% ANOVA!
% - LB/UBInputVarInterpolation ... determines the range of input variable
% for the DoE Analysis
%
% You can get: -
%
% For more information about sets and get see documentation of
% "doANOVAandPrediction".
%
% Copyright 2014-2016: Lars Freier, Eric von Lieres
% See the license note at the end of the file.

Expand Down
38 changes: 18 additions & 20 deletions dependencies/@AnalyzeKriging/doFullFactorialAnalysis.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,31 @@
% [] = doFullFactorialAnalysis(obj,KrigingObjectIndex)
% This function create a full factorial + center point design inside of the Kriging
% interpolation and applies afterwards an ANOVA.
% KrigingObjectIndex ... Index of the Kriging object on which the ANOVA
% should be applied.
% You can get:
% ANOVACoefficients ... contains the polynomial coefficient calculated during the
% ANOVA-Analysis
% ANOVACovMatrix ... Contain the covariance of the polynomial coefficient calculated
% during the ANOVA-Analysis
% ANOVAStdOfCoefficients ... contains the standard deviation of the polynomial coefficient
% calculated during the ANOVA-Analysis
% ANOVATvalue ... contain the t-value for t-test in order to decide which of the
% polynomial coefficient differ significantly from zero
% ANOVAPvalue ... Contain the p-value for t-test in order to decide which of the
% polynomial coefficient differ significantly from zero. Ususally
% values lower than 0.05 represent significant coefficients
%
% Input:
% - KrigingObjectIndex ... index of Kriging object of interest
%
% Output: -
%
% You can set:
% ShowDetails ... a table is display which contains the variable in the of
% "You can get"
% Be aware that all get variable are overwritten ecerytime you run an
% ANOVA!
% - ShowDetails ... a table is display which contains the variable in the of
% - LB/UBInputVarInterpolation ... determines the range of input variable
% for the DoE Analysis
%
% You can get: -
%
% For more information about sets and get see documentation of
% "doANOVAandPrediction".
%
% Copyright 2014-2016: Lars Freier, Eric von Lieres
% See the license note at the end of the file.
%% Initialization
nInputVar = obj.KrigingObjects{KrigingObjectIndex}.getnInputVar;
inputData = obj.KrigingObjects{KrigingObjectIndex}.getInputData;
nData = 2^nInputVar;
normInputMatrix = zeros(nData,nInputVar);
inputMatrix = zeros(nData,nInputVar);
% Copyright 2014-2016: Lars Freier, Eric von Lieres
% See the license note at the end of the file.


%% Experimental design

Expand Down
14 changes: 12 additions & 2 deletions dependencies/@AnalyzeKriging/labelPlots_23D.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function labelPlots_23D(obj,varargin)
KrigingObjectIndex = varargin{1};
dimensionInterpolation = varargin{2};
plotExpectedImprovement = varargin{3};
plotContour = varargin{4};

%% Actual Labeling
switch dimensionInterpolation
Expand All @@ -35,11 +36,20 @@ function labelPlots_23D(obj,varargin)
xlabel(obj.InputVarNames{KrigingObjectIndex(1)}(obj.KrigingPrediction_Interpolation3D{KrigingObjectIndex,3}(1)),'FontSize',obj.FontSize);
ylabel(obj.InputVarNames{KrigingObjectIndex(1)}(obj.KrigingPrediction_Interpolation3D{KrigingObjectIndex,3}(2)),'FontSize',obj.FontSize);
end

if plotExpectedImprovement
zlabel('Expected Improvement','FontSize',obj.FontSize);
zString = 'Expected Improvement';
else
zString = obj.KrigingObjectNames{KrigingObjectIndex};
end
if plotContour
hColorBar = colorbar;
ylabel(hColorBar,zString,'FontSize',obj.FontSize);
else
zlabel(obj.KrigingObjectNames{KrigingObjectIndex},'FontSize',obj.FontSize);
zlabel(zString,'FontSize',obj.FontSize);
end


otherwise
error('Plotting function is only allowed for 2D and 3D interpolation')
end
Expand Down
Loading

0 comments on commit 8163606

Please sign in to comment.