/ tutorials / laplace-dirichlet
Sign in
tutorials / laplace-dirichlet
laplace-dirichlet / src / matlab / lp_thin.m
12 lines · 363 BBlameHistoryRaw
1function [Ms, xs, ys] = lp_thin(M, x, y, maxn)
2% LP_THIN Subsample a field so that a picture of it fits in a JSON message.
3%
4% Keeps at most maxn points in each direction, always including both ends.
5nx = numel(x);
6ny = numel(y);
7ix = round(linspace(1, nx, min(nx, maxn)));
8iy = round(linspace(1, ny, min(ny, maxn)));
9Ms = M(iy, ix);
10xs = x(ix);
11ys = y(iy);
12end
↑↓ move↵openescclose