How to obtain a meshgrid surf plot on the right coordinate location?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Philippe Corner
il 13 Mar 2020
Commentato: Philippe Corner
il 31 Mar 2020
I'm trying to use this code for ploting this gridding on its correct location with a 3D perspective.
please be sure your cd is the same location of L10.mat and L10D.mat downloaded files.
load L10.mat; %find it attached
load L10D.mat; %find it attached
plot3(L10(:,2),L10(:,3),L10(:,4),'k','linewidth',1)
hold on
scatter3(L10D(:,2),L10D(:,3),L10D(:,4),'filled','k');
hold on
x = L10D(:,2); y = L10D(:,3); z = L10D(:,4); c = L10D(:,5);
xv = linspace(min(L10D(:,2)), max(L10D(:,2)), 120); yv = linspace(min(L10D(:,3)), max(L10D(:,3)), 120);
[X,Y] = meshgrid(xv, yv); Z = griddata(x,y,z,X,Y); C = griddata(x,y,c,X,Y);
surf(X, Y, Z,'cdata',C);
box on
view(-80,20)
This code is ploting the figure:
But, we easily can check that the rigth gridding surf plot corresponds to the figure:
Note, when I run the code, it appears this error:
Warning: Duplicate data points have been detected and
removed - corresponding values have been averaged.
Warning: Duplicate data points have been detected and
removed - corresponding values have been averaged.
Any ideas what could be my code error for acquiring this figure?
0 Commenti
Risposta accettata
darova
il 14 Mar 2020
You are interpolation in Z direction
Try to interpolate in X
yy = linspace(min(y),max(y),20);
zz = ...
[Y,Z] = meshgrid(yy,zz)
X = griddata(y,z,x,Y,Z);
...
6 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!