I'd like to interpolate a surface using c#. The situation is the following:
A set of x,y,z coordinates is given. Now I d like to interpolate between those points using a finer grid. Actually I d like to know the z coordinate at a certain point, e.g. x=2.2, y=1.6 z =??.
I was able to solve the interpolation using MatLab, but was not successful while using c#.. Furthermore, I was able to plot surfaces with ilnumerics, and tried to find some information on their homepage.
EDIT:
I think I need to clarify some things - sorry for the confusing way of asking my question
here you can see how I draw the surface out of some points:
using System;
using System.Drawing;
using System.Windows.Forms;
using ILNumerics;
using ILNumerics.Drawing;
using ILNumerics.Drawing.Plotting;
namespace Surface
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void ilPanel1_Load(object sender, EventArgs e)
{
using (ILScope.Enter())
{
ILArray<float> R = ILMath.linspace<float>(0, 5, 5);
ILArray<float> R1 = ILMath.linspace<float>(0, 25, 5);
ILArray<float> y = 1;
ILArray<float> x = ILMath.meshgrid(R, R, y);
ILArray<float> z = ILMath.meshgrid(R * R, R, y);
ILArray<float> Z = ILMath.zeros<float>(x.S[0], x.S[1], 3);
Z[":;:;1"] = x;
Z[":;:;2"] = y;
Z[":;:;0"] = z;
ilPanel1.Scene.Add(new ILPlotCube(twoDMode: false) {
new ILSurface(Z, colormap: Colormaps.Cool) {
Colors = 1.4f * x * x * x + 0.13f * y * y,
Childs = { new ILColorbar() }
}
});
}
}
}
}
The x and y coordinates are linearly distributed from 0 to 5 and the z coordinate has an quadratic shape. I d like to now the value of the z coordinate at a certain x,y coordinate, e.g. x=2.2, y=1.6 z =?? - which is definitely not a know point on my surface. So I thought it would be a good idea to interpolate the surface with an "finer" grid, that I m able to read out the value of the z coordinate...