フィルターのクリア

How do I plot points on a contour?

39 ビュー (過去 30 日間)
민제 강
민제 강 2021 年 6 月 8 日
回答済み: Star Strider 2021 年 6 月 8 日
data = readtable('Sample.xlsx');
ux1 = unique(data.x1);
nx1 = length(ux1);
X1 = reshape(data.x1, [], nx1);
X2 = reshape(data.x2, [], nx1);
Y = reshape(data.Y, [], nx1);
K = reshape(data.Kriging, [], nx1);
kerr = Y - K;
contourf(X1, X2, abs(kerr), 20);
colormap turbo
xlabel('x1')
ylabel('x2')
title('Sample(n=20)')
colorbar
caxis([0 1.5])
I want to mark the kriging.xlsx file on the contour.
Please let me know. Thank you

採用された回答

Star Strider
Star Strider 2021 年 6 月 8 日
I am not certain what result you want.
I plotted it with scatter3, however if the intent os to have lines connecting the points, use plot3.
data = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/645250/Sample.xlsx');
krin = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/645255/kriging.xlsx');
ux1 = unique(data.x1);
nx1 = length(ux1);
X1 = reshape(data.x1, [], nx1);
X2 = reshape(data.x2, [], nx1);
Y = reshape(data.Y, [], nx1);
K = reshape(data.Kriging, [], nx1);
kerr = Y - K;
figure
contourf(X1, X2, abs(kerr), 20)
hold on
scatter3(krin.x1, krin.x2, krin.kriging, 50, 'r', 'filled')
hold off
colormap turbo
xlabel('x1')
ylabel('x2')
title('Sample(n=20)')
colorbar
caxis([0 1.5])
.

その他の回答 (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