view stencilEquation.m @ 1199:dfb1b84b63f4 feature/joingrids

Add multiblock.joinGrids, which joins several multiblock grids into one.
author Martin Almquist <malmquist@stanford.edu>
date Sat, 17 Aug 2019 16:20:07 -0700
parents 184833fe4c0e
children
line wrap: on
line source

% Find the equation for the stencil for d^k/dx^k
function [A,b] = stencilEquation(k, offsets, order)
    q = sym('q', [1, length(offsets)]);

    p = 0:(order-1+k);

    v     = vandermonde(offsets, p);
    vdiff = vandermonde(      0, p-k);

    eq = q*v == vdiff;

    [A,b] = equationsToMatrix(eq, q);
end