concept-collection / numbl-surfacefun-intro
numbl-surfacefun-intro / fun_plot.m
16 lines · 454 BBlameHistoryRaw
1% fun_plot.m — A scalar function on a surface (surfacefun).
2%
3% A surfacefun represents a scalar field on a surfacemesh, built from a
4% function handle of the Cartesian coordinates (x,y,z).
6mip load --install flatironinstitute/flatironinstitute/surfacefun
8p = 16;
9nref = 2;
10dom = surfacemesh.sphere(p + 1, nref);
12f = surfacefun(@(x, y, z) cos(6*x) .* y + exp(z), dom);
14figure(1);
15plot(f), hold on, plot(dom), colorbar
16title('f = cos(6x) y + e^z');