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 CenterFile Exchange에서 Timing 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