% fun_arithmetic.m — Overloaded arithmetic on surfacefuns. % % Standard MATLAB arithmetic is overloaded for surfacefuns, so you can % combine fields with +, -, .*, abs, etc. mip load --install flatironinstitute/flatironinstitute/surfacefun p = 16; nref = 2; dom = surfacemesh.sphere(p + 1, nref); f = surfacefun(@(x, y, z) cos(6*x) .* y + exp(z), dom); x = surfacefun(@(x, y, z) x, dom); g = abs(f + 2*x); figure(1); plot(g), colorbar title('g = |f + 2x|');