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

3 vues (au cours des 30 derniers jours)
Matt Williams
Matt Williams le 1 Fév 2024
Commenté : Voss le 1 Fév 2024
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)')

Réponse acceptée

Voss
Voss le 1 Fév 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])
  2 commentaires
Matt Williams
Matt Williams le 1 Fév 2024
Thank you very much for this
Voss
Voss le 1 Fév 2024
You're welcome!

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by