This commit is contained in:
Lisa Pizzo 2026-01-13 20:01:21 +01:00
commit 5ab9e5d527
3 changed files with 31 additions and 0 deletions

10
Sheet6/h_adapt.m Normal file
View file

@ -0,0 +1,10 @@
function xnew = h_adapt(x,eta,theta) %eta is local error
xnew = x(1);
for i = 1:length(x)-1
if eta(i) > theta*max(eta) %if local error is large, inster a midpoint
xnew = [xnew, (x(i)+x(i+1))/2];
end
xnew = [xnew, x(i+1)]; %if local error is small, keep the element unchanged
end
xnew = unique(xnew);
end