surf creates two surfaces, one matches the data points but the other incorrectly connects opposite edges directly

2 ビュー (過去 30 日間)
surf creates two surfaces, one matches the data points but the other incorrectly connects opposite edges together. How to generate a single surface only connecting adjacent points?
Code:
fidDoubleCrossover = fopen('doublecrossover.txt');
% fill the array in column order:
DoubleCrossover = fscanf(fidDoubleCrossover, '%d', [3 inf]);
DoubleCrossover = DoubleCrossover';
% close the file
fclose(fidDoubleCrossover);
x = DoubleCrossover(:,1);
y = DoubleCrossover(:,2);
z = DoubleCrossover(:,3);
[X,Y] = meshgrid(x,y);
Z = griddata(x,y,z, X, Y,'natural');
figure('color',[1,1,1]);
h = surf(X,Y,Z,'FaceAlpha',0.1);
hold on
stem3(X,Y,Z,'.','MarkerSize',15)
Data in file:
5 5 1195
15 5 2165
25 5 1159
35 5 1186
45 5 1474
5 15 1059
15 15 1001
25 15 946
35 15 1003
45 15 949
5 25 1203
15 25 992
25 25 927
35 25 925
45 25 923
5 35 1192
15 35 1026
25 35 946
35 35 943
45 35 927
5 45 1066
15 45 967
25 45 936
35 45 934
45 45 925

採用された回答

darova
darova 2020 年 1 月 19 日
Try
x1 = linspace(min(x),max(x),5);
y1 = linspace(min(y),max(y),5);
[X,Y] = meshgrid(x1,y1);
Please use special buttons
CODE_INSER.PNG

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTiming and presenting 2D and 3D stimuli についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by