.
This commit is contained in:
parent
43bc7df338
commit
5ab9e5d527
3 changed files with 31 additions and 0 deletions
11
Sheet6/r_adapt.m
Normal file
11
Sheet6/r_adapt.m
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
function xnew = r_adapt(x,eta_elem)
|
||||
N = length(x);
|
||||
w = abs(eta_elem) + 1e-10; %error based monitor function
|
||||
s = zeros(N,1);
|
||||
for i = 2:N
|
||||
s(i) = s(i-1) + w(i-1); %cumulative sum
|
||||
end
|
||||
s = s / s(end); % normalize to [0,1]
|
||||
s_new = linspace(0,1,N)';
|
||||
xnew = interp1(s, x, s_new, 'linear');
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue