Assuming that the pressure gradient is represented by a function f(x) and that its true or exact value is unknown, the error of an approximate solution g(x) can be estimated using the L2-norm as follows:
main.m195 chars6 lines
Here, f-g represents the difference between the true and approximate solutions at each location, (0.2)^2 represents the square of the spatial resolution, and the sum and sqrt functions perform the summation and square root required by the L2-norm formula.
Note that the choice of the approximate solution g and the spatial resolution 0.2 will affect the accuracy of the error estimate. In general, higher-resolution approximations should provide more accurate error estimates. Additionally, if the true solution f is not known, it may be difficult to judge the accuracy of the error estimate.
gistlibby LogSnag