% 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