.
This commit is contained in:
parent
43bc7df338
commit
5ab9e5d527
3 changed files with 31 additions and 0 deletions
10
Sheet6/h_adapt.m
Normal file
10
Sheet6/h_adapt.m
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue