I have 3 variables (x, y, z) each in a 192×1 vector. The data is all random and sometimes has missing values (NaNs).
I would like to plot variable c against the other two variables x and y as contour plot (x on the x-axis, y on the y-axis, and z making up the contour lines).
My biggest problem is making up the 192×192 matrix for x and y because x and y consist of random data. I have tried to use GRIDDATA, Delaunay, and TriScatteredInterp but they did not work because I have NaNs in my data.
Does anyone know what I can do? If there was a way that I could return the matrix of x vs y from the scatter plot of x and y then my problem would be solved.
Example code
x=rand(192,1);
y=rand(192,1);
z=rand(192,1);
[X,Y]=meshgrid(x,y);
contour(X,Y,z);
??? Error using ==> contour at 74
Z must be size 2×2 or greater.
What are you going to do with NaNs? Do they contain any additional information to draw the contour plot? Cannot you just remove them?
Then you can apply solution from this question. The missing data will be interpreted anyway.