# How to calculate the field on the surface created with Delaunay triangulation?

4 views (last 30 days)
Nima on 18 Oct 2020
Commented: Nima on 18 Oct 2020
In the following code x, y, z corresponde to the point coordinates in a volume, and then a surface is created using Delaunay triangulation.
The values of magnetic flux density at the points are B_x, B_y, B_z . The problem is to estimate or calculate (eg. interpolation or ...) the 3D magnetic fields on this surface. I will appriciate of any idea.
x = [-0.76; -1.82; -0.81; -0.35; 0.05; -0.23; -0.72; -0.85; 0.87; 0.73; -1.86; 1.50; -0.90; -1.63; 0.31; 0.01; -0.04; -1.92; -0.61; 0.83];
y = [0.04; 0.65; -1.07; -1.34; -1.70; 1.40; -1.53; -1.25; 1.42; 0.67; 0.01; -0.38; 1.42; -0.96; 1.92; -1.86; 1.46; -0.07; -1.84; -0.68];
z = [1.79; 0.18; -1.40; -1.36; -0.94; 1.32; -0.95; 1.22; -1.00; 1.67; -0.58; -1.18; -0.97; 0.45; -0.10; -0.57; 1.29; 0.33; 0.19; 1.62];
B_x = [0.00014; -0.00014; 0.0002; -0.00019; -0.00024; 0.00025; -0.00023; 0.00016; -0.00016; 4.62e-05; 1.56e-05; 8.07e-05; 0.00013; 0.00017; -0.00025; 0.00025; -0.00026; -0.00017; 0.00017; 6.24e-05];
B_y = [1.24e-09; 2.92e-08; -1.30e-07; 7.09e-08; -2.02e-07; -1.23e-07; -1.62e-07; 4.57e-08; 1.52e-07; 1.71e-07; 7.88e-08; -2.14e-07; -1.38e-07; -1.14e-07; 2.63e-07; 1.31e-07; -1.09e-07; -5.48e-09; -1.36e-07; 7.82e-08];
B_z = [-0.0001; -0.0001; -7.51e-05; -8.704e-05; -1.76e-05; 0.0001; 0.00017; 0.00028; 0.0003; 0.0003; 0.0003; 0.0003; 0.00029; 0.00027; 0.00014; 0.00014; 6.78e-05; -0.0001; -0.0001; -0.00016];
T = delaunayTriangulation(x,y,z) % Delaunay Triangulation
figure(1)
plot3(x,y,z,'ro')
figure(2)
[K,v] = convexHull(T);
trisurf(K,T.Points(:,1),T.Points(:,2),T.Points(:,3))

Bjorn Gustavsson on 18 Oct 2020
If you have the magnetic field components at the points [x,y,z] then you should be able to use TriScatteredInterp or (preferably, since it is "newer") scatteredInterpolant. Either for the individual components, or for the magnetic field-strength to re-interpolate to whatever grid you want. For one component it would look something like this:
f_Bx = scatteredInterpolant([x(:),y(:),z(:)],B_x,'natural');
Bx_i = f_Bx([xi(:),yi(:),zi(:)]);% Here xi etc are your re-interpolation-grid-points
If your surface is reasonably flat you might get a neater result if you exclude the variable with the small variation.
HTH
##### 3 CommentsShow 1 older commentHide 1 older comment
Bjorn Gustavsson on 18 Oct 2020
What is it you want to achieve? If you have the components of the magnetic-field at your triangular points you are, at least in some sense, done. You have your points, you have the triangular surfaces connecting them, what more do you need to do?
Nima on 18 Oct 2020
I want the field on the surface figure(2) not inside the volume figure(3)...my question is: what is the appropriate grid for interpolating on this surface?

### Categories

Find more on Delaunay Triangulation in Help Center and File Exchange

R2020a

### Community Treasure Hunt

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

Start Hunting!