Contourf with irregular spaced points

Contourf works if I define X and Y as monotonic increasing values. For eg.,
X=[1:3]; Y=[1:3]; Z=[10 20 30; 40 50 60; 70 80 90]; contourf(X,Y,Z);
Now, when I want to plot using contourf, but with irregular values of X, Y, for the same Z value, how will I go about this? For eg.,
X=[ 1.3 2.2 3.1 1.9 2.7 3.6 2.4 3.2 4.1];
Y=[-0.3 0.1 0.6 -1.2 -0.7 -0.2 -2.1 -1.6 -1.1];
Z=[10 20 30; 40 50 60; 70 80 90]; contourf(X,Y,Z);
The error msg: "The size of X must match the size of Z or the number of columns of Z."
Thanks,
Ganesh

 Réponse acceptée

Walter Roberson
Walter Roberson le 23 Juil 2012

0 votes

You will need to use something like TriScatteredInterp over a regular grid and contour that. contour() and contourf() are not suitable for scattered points.

Plus de réponses (0)

Catégories

En savoir plus sur Contour Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by