How do I plot points on a contour?

84 visualizzazioni (ultimi 30 giorni)
민제 강
민제 강 il 8 Giu 2021
Risposto: Star Strider il 8 Giu 2021
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

Risposta accettata

Star Strider
Star Strider il 8 Giu 2021
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])
.

Più risposte (0)

Categorie

Scopri di più su Contour Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by