1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| %Divide the time range into subdomains on which specific error
%margins have an influence
[subDomains,idxOfInfluence_init,idxOfInfluence_fin]=obj.outputExp.determineSubDomains(stepSize);
%go through all the subdomains
for j=1:2:length(subDomains)
%set it1 and it2 indexes to the beginning of the subdomain
it1.setIndex(round(subDomains(j)));
it2.setIndex(round(subDomains(j)));
%Case where a subdomain is influenced by only one error margin
if length(idxOfInfluence_init{(j+1)/2})==1
while round(subDomains(j))<=it1.index && it1.index<=round(subDomains(j+1))
indStart=idxOfInfluence_init{(j+1)/2};
indEnd=idxOfInfluence_fin{(j+1)/2};
it1.computeExtremeValues(indStart,indEnd,stepSize);
%Perform the checking against y_max and y_min
if ~(it1.y_min <=output((it1.index)))||~(output((it1.index))<= it1.y_max)
failedInstants=[failedInstants (it1.index-1)*stepSize];
%exist the loop if an error is encountred and go
%to the next sub domain
break
end
%go to the next index
it1.increment();
it2.increment();
end
%Case where a subdomain is influenced by two error margins
elseif length(idxOfInfluence_init{(j+1)/2})==2
while round(subDomains(j))<=it1.index && it1.index<=round(subDomains(j+1))
indStart11=idxOfInfluence_init{(j+1)/2}(1);
indEnd21=idxOfInfluence_fin{(j+1)/2}(1);
indStart12=idxOfInfluence_init{(j+1)/2}(2);
indEnd22=idxOfInfluence_fin{(j+1)/2}(2);
it1.computeExtremeValues(indStart11,indEnd21,stepSize);
it2.computeExtremeValues(indStart12,indEnd22,stepSize);
%Perform the checking against y_max and y_min
if ~((it1.y_min<= output(it1.index)) || ~(output(it1.index)<=it1.y_max))...
&& ~((it2.y_min<= output(it1.index)) || ~(output(it1.index)<=it2.y_max))
failedInstants=[failedInstants (it1.index-1)*stepSize];
%exist the loop if an error is encountred and go
%to the next sub domain
break
end
%go to the next index
it1.increment();
it2.increment();
end
end |
Partager