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

4 views (last 30 days)
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)')

Accepted Answer

Voss
Voss on 1 Feb 2024
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])

More Answers (0)

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!