Plots using contourf in matlab

1 回表示 (過去 30 日間)
mukesh bisht
mukesh bisht 2021 年 4 月 27 日
回答済み: Star Strider 2021 年 4 月 27 日
I have a matrix P (10,3)
X = (:,1); Y = (:,2); Z = (:,3);
I am using contourf(X,Y,Z,'LineColor','none')
But is shows the error "Error using contourf Z must be at least a 2x2 matrix."
Please help. How to slove this

採用された回答

Star Strider
Star Strider 2021 年 4 月 27 日
Try something lilke this —
X = P(:,1);
Y = P(:,2);
Z = P(:,3);
Xv = linspace(min(X),max(X),numel(X))
Yv = linspace(min(Y),max(Y),numel(Y))
[Xm,Ym] = meshgrid(Xv,Yv);
Zm = griddata(X,Y,Z,Xm,Ym);
figure
contourf(Xm, Ym, Zm)
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by