Contour plot of XYZ data
9 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have attached X(:,1)Y(:,2)Z(:,3) data from which I would like to create a 2D contour plot. Thank you in advance for any help.
0 件のコメント
回答 (1 件)
Ameer Hamza
2020 年 12 月 30 日
編集済み: Ameer Hamza
2020 年 12 月 30 日
Try this
x = hfm(:,1);
y = hfm(:,2);
z = hfm(:,3);
xg = linspace(min(x),max(x));
yg = linspace(min(y),max(y));
[Xg, Yg] = meshgrid(xg, yg);
Zg = griddata(x, y, z, Xg, Yg);
contour(Xg, Yg, Zg)
or following if you want to extrapolate the data too
x = hfm(:,1);
y = hfm(:,2);
z = hfm(:,3);
xg = linspace(min(x),max(x));
yg = linspace(min(y),max(y));
[Xg, Yg] = meshgrid(xg, yg);
mdl = scatteredInterpolant(x, y, z);
Zg = mdl(Xg, Yg);
contour(Xg, Yg, Zg)
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Contour Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!