Uploading ex6
This commit is contained in:
parent
7c73cd8e82
commit
a2769c0417
4 changed files with 78 additions and 0 deletions
16
Sheet_6/jumps_flux.m
Normal file
16
Sheet_6/jumps_flux.m
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
% calculation of the flux jumps according to the chosen mesh
|
||||
% nodes - corresponding to the mesh
|
||||
% u - approximation
|
||||
% flux_jumps - jump of the flux in each node of the mesh including the
|
||||
% paramter function lambda
|
||||
|
||||
function flux_jumps = jumps_flux(nodes, u, lambda)
|
||||
n_nodes = length(nodes);
|
||||
flux_jumps = zeros(n_nodes,1);
|
||||
diff_u = u(2:end) - u(1:end-1);
|
||||
diff_x = nodes(2:end) - nodes(1:end-1);
|
||||
eps = 1e-8;
|
||||
for i = 2:n_nodes-1
|
||||
flux_jumps(i) = diff_u(i)/diff_x(i)*lambda(nodes(i)+eps) - diff_u(i-1)/diff_x(i-1)*lambda(nodes(i)-eps);
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue