I am using the Accord.Math Namespace for Visual Studio in c#.
I am trying to use the method MeshGrid<> under the Matrix class for the Accord.Math namespace. However, I am unsure how to implement this method even after reading the documentation for it seen here: http://accord-framework.net/docs/html/M_Accord_Math_Matrix_MeshGrid__1.htm
Can anybody show me how to properly implement this method?
I have two Double[,] variables named xa and ya that I am trying to pass to MeshGrid. I have tried calling by using:
var q = Matrix.MeshGrid(xa,ya);
But for this is says that the type arguments cannot be inferred from their usage.
The output of MeshGrid is a 2-Tuple. T1 is T[,] T2 is T[,]
The MeshGrid method in Accord.NET is analogous to MATLAB's and Octave's meshgrid functions. It can be used to help creating surface plots, such as this one detailed in Octave's documentation page. This method accepts two vectors as inputs, and unfortunately doesn't work if you are passing two double[,] matrices instead of double[] vectors.
If you would like to see how it works and what is the output generated by this method, perhaps we run a little snippet using the MeshGrid function in LINQPad. If you are interested, copy and paste the following LINQpad query definition in a text file and save it with a ".linq" extension:
After you save this file with a ".linq" extension, double-click it to open it using LINQPad:
Once in LINQPad, execute the above snippet by hitting F5. You will get the following output windows showing the contents of the X and Y matrices, respectively: