Calculate derivatives in a non-uniform grid
I have a non-uniform 2D grid (non-equal intervals between nodes). [x,y]
I also have the data (U) calculated on this grid. I want to calculate the derivatives of U with respect to y and then x. How can I do this? (Specially using MATLAB) |
Is it rectangular grid?
You could just use matrix operations ie dmyfdx = (myf(2:end)-myf(1:end-1)) / (coordx(2:end)-coordx(1:end-1)) where myf is your variable and coordx is the x coordinate in the grid. If this is not sufficiently helpful then please create a small test case demonstrating the data format in a small example. Thanks. |
Quote:
|
I think you can view the formulas here
http://web.media.mit.edu/~crtaylor/calculator.html Vary the number of input points to get the desired order of accuracy. |
Quote:
For example, you have the value f1,f2,f3 at x1,x2,x3. Then you can define a lagrangian second degree polynomial and compute analytically the derivative. More nodes allow you to increase the degree of the polynomial and the accuracy of the derivative. Have also a look to the textbook of Peric & Ferziger |
Quote:
|
All times are GMT -4. The time now is 17:22. |