surface and plot3 linking edges that should not be linked on the plot

조회 수: 2 (최근 30일)
Matt Williams
Matt Williams 2024년 2월 1일
댓글: Voss 2024년 2월 1일
The following code produces a plot which has a linked edge running across the plot, running on R2023b:
  • see attached file for the data where 'T' becomes x,'x' becomes y and 'V(x,t)' becomes z
The code:
x = double(table2array(SystemLearning(:,1)));
y = double(table2array(SystemLearning(:,2)));
z= double(table2array(SystemLearning(:,3)));
[X,Y] = meshgrid(x,y);
% Z = griddata(x,y,z,X,Y,'natural');
% Z = griddata(x,y,z,X,Y,'cubic');
Z = griddata(x,y,z,X,Y,'cubic');
mesh(X,Y,Z)
axis tight; hold on
plot3(x,y,z,'.','MarkerSize',15)
%surf(X,Y,Z, 'EdgeColor','none')
xlabel('Time(t)')
ylabel('space(x)')
zlabel('V(x,t)')

채택된 답변

Voss
Voss 2024년 2월 1일
SystemLearning = readtable('SystemLearning.csv','VariableNamingRule','preserve');
x = SystemLearning{:,1};
y = SystemLearning{:,2};
z = SystemLearning{:,3};
NX = numel(unique(x));
X = reshape(x,[],NX);
Y = reshape(y,[],NX);
% Z = griddata(x,y,z,X,Y,'natural');
Z = griddata(x,y,z,X,Y,'cubic');
mesh(X,Y,Z)
axis tight; hold on; grid on
plot3(x,y,z,'.','MarkerSize',15)
% surf(X,Y,Z, 'EdgeColor','none')
xlabel('Time(t)')
ylabel('space(x)')
zlabel('V(x,t)')
view([70 20])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by