plot_importancefactors

PURPOSE ^

PLOT_IMPORTANCEFACTORS - plot importance factors

SYNOPSIS ^

function plot_importancefactors(md,options_structure,width,ii);

DESCRIPTION ^

PLOT_IMPORTANCEFACTORS - plot importance factors

   Usage:
      plot_importancefactors(md,options_structure,width,i);

   See also: PLOTMODEL

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plot_importancefactors(md,options_structure,width,ii);
0002 %PLOT_IMPORTANCEFACTORS - plot importance factors
0003 %
0004 %   Usage:
0005 %      plot_importancefactors(md,options_structure,width,i);
0006 %
0007 %   See also: PLOTMODEL
0008 
0009 %first recover design variable descriptor
0010 if ~isnan(options_structure.designvariable),
0011     descriptor=options_structure.designvariable;
0012 else
0013     error('plot_importancefactors error message: Need to supply design variable descriptor');
0014 end
0015 descriptorlength=length(descriptor);
0016 
0017 %then recover responsfunction name
0018 if ~isnan(options_structure.responsefunction),
0019     responsefunctiondescriptor=options_structure.responsefunction;
0020 else
0021     error('plot_importancefactors error message: Need to supply response function descriptor');
0022 end
0023 
0024 %go through all response functions and find the one corresponding to the correct responsefunctiondescriptor
0025 responsefunctions=md.dakotaresults{2};
0026 found=0;
0027 for i=1:length(responsefunctions),
0028     if strcmpi(responsefunctions(i).descriptor,responsefunctiondescriptor),
0029         found=i;
0030         break;
0031     end
0032 end
0033 if ~found,
0034     error('plot_importancefactors error message: could not find correct response function');
0035 end
0036 responsefunctions=responsefunctions(found);
0037 nfun=size(responsefunctions.desvar,1);
0038 
0039 %Now recover response to the correct desgin variable
0040 importancefactors=zeros(md.npart,1);
0041 count=0;
0042 for i=1:nfun,
0043     desvar=responsefunctions.desvar{i};
0044     if strncmpi(desvar,descriptor,descriptorlength),
0045         count=count+1;
0046         importancefactors(count)=responsefunctions.impfac(i);
0047     end
0048 end
0049 if count==0,
0050     error('plot_importancefactors error message: could not find to response functions with corresponding design variable');
0051 end
0052 
0053 %log?
0054 if ~isnan(options_structure.log),
0055     logvalue=options_structure.log;
0056     importancefactors=log(importancefactors)/log(logvalue);
0057 end
0058 
0059 %Ok, get partitioning.
0060 [epart npart]=MeshPartition(md,md.npart);
0061 
0062 %distribute importance factor
0063 gridimportance=importancefactors(npart);
0064 
0065 %process data and model
0066 [x y z elements is2d]=processmesh(md,options_structure);
0067 
0068 %edgecolor?
0069 if ~isnan(options_structure.edgecolor),
0070     edgecolor=options_structure.edgecolor;
0071 else
0072     edgecolor='none';
0073 end
0074 
0075 %standard plot:
0076 subplot(width,width,ii);
0077 
0078 %ok, plot gridimportance now.
0079 if is2d,
0080     A=elements(:,1); B=elements(:,2); C=elements(:,3); 
0081     patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', gridimportance,'FaceColor','interp','EdgeColor',edgecolor);
0082 else
0083     error('plot_importancefactors error message: 3d meshes not supported yet');
0084 end
0085 
0086 %apply options
0087 applyoptions(md,[],options_structure);

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003