Reconstructed boundary

Best-fitting curve in each cell. Click a cell to inspect it.

  • Marker points
  • Best fit per cell

Cell

    Zoomed to the cell's points, with x and y scaled separately. Hover a point to see its residuals.

    Fits for the selected cell, computed in your browser
    Model Fitted equation Squared error cond(A) cond(AᵀA)

    How it works

    Each model is written as an overdetermined system A·x = b, where every column of A is a basis function evaluated at the cell's points, and solved with the normal equations x = (AᵀA)⁻¹Aᵀb.

    The squared error is the sum of the squared residuals, Σ(b − A·x)². Because cond(AᵀA) = cond(A)², forming AᵀA squares the conditioning of the problem. Inside one small cell the x values are close together, so the cubic's columns 1, x, x², x³ are nearly parallel and cond(AᵀA) reaches about 10¹⁷. In cells 48 and 55, the original MATLAB script's inv(AᵀA) produced cubic errors larger than the parabola's, which is impossible in exact arithmetic since every parabola is also a cubic. This page solves the normal equations with Gaussian elimination and partial pivoting, which stays within 0.05% of a stable QR solution for those cells.

    The original MATLAB implementation is in the matlab folder of this repository.