Differentiation in 2D for Non Uniformly Distributed Data

26 visualizaciones (últimos 30 días)
Julia
Julia el 10 de Abr. de 2014
Respondida: jennifer el 11 de Nov. de 2024 a las 13:48
Hello, My problem is quite simple, I think, but I cannot find a solution.
I have a 2d scatter plot of an electric field. So basically I have a nx3 matrix, let's call it M, where the 2 first columns are the x and y coordinates, and the 3rd column is a value between 0 and 1 Volts.
So I basically plot this as: scatter(M(:,1),M(:,2),5,M(:,3));
I would like to calculate the second order spatial derivative of this electric field in 2 Dimensions. But I don't know how to do that. I tried using the gradient function, but this doesn't work. I think this is due to the fact that my 2D space is not uniformly distributed (it was exported by a FEA in COMSOL).
Thank you in advance for your help.
Julia
  2 comentarios
Alberto
Alberto el 10 de Abr. de 2014
Editada: Alberto el 10 de Abr. de 2014
Hi Julia:
in a function like that, second order derivatives is the Hessian matrix. There are formulas for obtain the second order partial derivatives, I`m afraid you will have to implement them by yourself.
For example, for the first derivative, and you have the nodes x_0, x_1 and x_2:
f'(x_1)= [f(x_2) - f(x_0)]/(x_2 - x_0)
This first derivative aproximation doesn't need the spaces between the nodes. Once you have the functions derived, you can derived again in the same variable or the other one.
Julia
Julia el 10 de Abr. de 2014
Hello,
Thank you for your quick response!
Indeed, I should compute the Hessian matrix. However, I will get a 2x2 Matrix. How do I plot this? Do I plot the norm of the matrix?
Thank you for your help!

Iniciar sesión para comentar.

Respuestas (3)

Andrew Newell
Andrew Newell el 10 de Abr. de 2014
Editada: Andrew Newell el 10 de Abr. de 2014
Before using finite difference formulae, you should use TriScatteredInterp to create a gridded data set. You can't use the gradient function because it applies to functions, not fixed data points. Once you have obtained the Hessian, how you plot it depends on what you want to learn. For example, you might want to look at each component separately, or you might be interested in the norm.

Gypaets
Gypaets el 18 de Dic. de 2015
I've written a function which calculates first and second order spatial derivatives: trigradient2
You can get the second order derivatives approximation with
[~, ~, Uxx, Uyy, Uxy]=trigradient2(M(:,1),M(:,2),M(:,3));

jennifer
jennifer el 11 de Nov. de 2024 a las 13:48
Differentiating 2D data when it’s not uniformly distributed can be challenging because the data points are spaced unevenly, making standard methods less accurate. Specialized techniques, like using adaptive grids or interpolation, help achieve smoother results. For projects that involve complex data visualization, such as in animations, working with professionals can make a real difference. Partnering with a Video Animation Company in Dubai ensures accurate and visually engaging representation of data, helping audiences understand insights more effectively.

Categorías

Más información sobre Fractals en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by