MATLAB: How to plot Contour Plot

contour plot

I have 3 variables data in xls file. I want to plot contour plot of one variable against other 2 variables on x and y axis. How do I do this?

Best Answer

I assume your variables are vectors. If they are gridded, it is only necessary to use the reshape function to form them into matrices.
If they are not gridded, something like this will work:
x = rand(20, 1);
y = rand(20, 1);
z = rand(20, 1);
xv = linspace(min(x), max(x), 50);
yv = linspace(min(y), max(y), 50);
[X,Y] = ndgrid(xv, yv);
Z = griddata(x, y, z, X, Y);
figure
contourf(X, Y, Z)
Experiment to get the result you want.