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

 采纳的回答

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

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Contour Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by