I have got a file with field values (RF simulation of a resonator) which consists of 3 columns: X
and Y
cartesian coordinates and the field value E(X, Y)
with 9500 rows.
The problem is that my external field simulation software is not able to print the required field on a regular mesh (polar or cartesian map) as shown below:
-15.00000 -26.00000 345000.00000 15.00000 -26.00000 361000.00000 12.20000 -27.40000 490000.00000 -12.20000 -27.40000 583000.00000 -9.27000 -28.50000 1050000.00000 9.27000 -28.50000 1140000.00000 16.50000 -28.60000 436000.00000 -16.50000 -28.60000 491000.00000 6.24000 -29.30000 1520000.00000 -6.24000 -29.30000 1730000.00000 3.14000 -29.80000 2110000.00000
My goal is to create from the data above an interpolated surface from which I could generate a nice field matrix with a certain resolution.
My first idea was to use Gnuplot for this job so the scatter plot looks like this:
..and then interpolation of the field points on a regular grid like this:
However, Gnuplot is great but it cannot write this interpolated field back into a file for further post processing.
Now I am trying to apply the same procedure in Mathematica (ver 9) For this, I wrote the following simple commands:
stream = OpenRead["~/efields/em.dat"];
data = ReadList[stream, {Number, Number, Number}];
f = Interpolation[data];
ListPointPlot3D[{x, y, f[x, y]},
{x, Min[data[[All, 1]]], Max[data[[All, 1]]]},
{y, Min[data[[All, 2]]], Max[data[[All, 2]]]}]
Unfortunately this did not work and Mathematica returned with 2 error messages:
Interpolation::udeg: Interpolation on unstructured grids is currently only supported for InterpolationOrder->1 or InterpolationOrder->All. Order will be reduced to 1. >>
ListPointPlot3D::nonopt: "Options expected (instead of {y,-480.,-26.}) beyond position 1 in *
Can anybody provide some support hints on this issue. Lets start with the basic:
- How to plot the data correctly as scatter plot ?
- How to create a surface from the randomly distributed field values ?