sorted.m
1.17 KB
%Class that extends the abstract class TailMethod. The method compute_tail
%computes the upper and lower tail of a pdf by sorting its values and
%selecting the first and the last N samples. It takes in input
%an object TimeBehavior containing the values of the evaluation function,
%the array perturbation of perturbed parameters and tail_size which specifies
%the number of samples in each tail. It returns in output the following variables:
% - XiMin is the array containing parameter samples in the lower tail
% - XiMax is the array containing parameter samples in the upper tail
classdef sorted < TailMethod
properties
end
methods
function [XiMax,XiMin]=compute_tailspdf(obj,obj_TimeBehavior,perturbation,tail_size)
samples=obj_TimeBehavior.evalFuncValues;
[samples_sorted, indexes_sorted]=sort(samples);
XiMin=[];
XiMax=[];
for j=1:tail_size
XiMax=[XiMax;perturbation(indexes_sorted(length(samples)+1-j,1),:)];
XiMin=[XiMin;perturbation(indexes_sorted(j,1),:)];
end
end
end
end