Home > atmatch > atApplyVariation.m

atApplyVariation

PURPOSE ^

this functions applys a series of varaiation to variables as described in

SYNOPSIS ^

function ring=atApplyVariation(ring,Variables,NewValues)

DESCRIPTION ^

 this functions applys a series of varaiation to variables as described in
 Variables.

 Variables is a cell array of structures


 Variables  struct('Indx',{[indx],...
                           @(ring,varval)fun(ring,varval,...),...
                          },...
                   'Parameter',{{'paramname',{M,N,...},...},...
                                [initialvarval],...
                               },...
                   'LowLim',{[val],[val],...},...
                   'HighLim',{[val],[val],...},...
                   )


 varargin{1} may be a set of delta_0 to apply


 delata_0: is the applied set of perturbations
 varNum  : length(delta_0)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function ring=atApplyVariation(ring,Variables,NewValues)
0002 % this functions applys a series of varaiation to variables as described in
0003 % Variables.
0004 %
0005 % Variables is a cell array of structures
0006 %
0007 %
0008 % Variables  struct('Indx',{[indx],...
0009 %                           @(ring,varval)fun(ring,varval,...),...
0010 %                          },...
0011 %                   'Parameter',{{'paramname',{M,N,...},...},...
0012 %                                [initialvarval],...
0013 %                               },...
0014 %                   'LowLim',{[val],[val],...},...
0015 %                   'HighLim',{[val],[val],...},...
0016 %                   )
0017 %
0018 %
0019 % varargin{1} may be a set of delta_0 to apply
0020 %
0021 %
0022 % delata_0: is the applied set of perturbations
0023 % varNum  : length(delta_0)
0024 %
0025 
0026 % history of changes
0027 % created 25-8-2012
0028 % updated 28-8-2012 Variables may have a vector as PERTURBINDX
0029 % updated 30-8-2012 added 'Fam' filed for Families
0030 % updated 10-9-2012 Variation.('FUN') Variation.('FUN_PAR') added
0031 %                   to apply a modification of parameters non esplicitly
0032 %                   stated in the RING structure
0033 %                   Variation.('FUN')=@funtoeval
0034 %                   must have at least 2 args (THERING,parameter2vary)
0035 % updated 17-9-2012 Variation.('FUN_PAR') function may have more
0036 %                   input parameters that do not change
0037 % updated 17-9-2012 Variation.('FUN_VAR') function may have more
0038 %                   input parameters that may vary
0039 % updated 18-9-2012 Variables(var_indx).('StartVALUE') vector of intial
0040 %                   function variables values
0041 % updated 21-3-2013 main Variables structure change removed familiy option
0042 % updated 23-3-2013 removed loops
0043 % updated 25-3-2013 varibles as absolute values and not variations.
0044 %                   Indx and Parmaeter switched in case of function.
0045 %                   setfield(...Parameter{:}) instead of Parameter{1} or{2}
0046 
0047 
0048 ok=arrayfun(@setval,Variables,NewValues); %#ok<NASGU>
0049 
0050     function ok=setval(v,val)
0051         if isa(v.Indx,'function_handle')
0052             ring=v.Indx(ring,val{1});
0053         else
0054             ring(v.Indx)=cellfun(@(elem) setfield(elem,v.Parameter{:},...
0055                 val{1}),ring(v.Indx),'UniformOutput',false);
0056         end
0057         ok=0;
0058     end
0059         
0060 end
0061

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005