Effacer les filtres
Effacer les filtres

Plotting 4D surface plot (x,y,z and one is colour bar)

5 vues (au cours des 30 derniers jours)
Sanjib
Sanjib le 25 Avr 2022
Commenté : Sanjib le 25 Avr 2022
I have some output from a complex relation , the 4 variable are in coloumns as x,y,z, and m and I need a 4D data surface plot,( not using scatter3 ) the data are as given below
-0.5788245 0.30687669 0.22984767 0.22355179
-0.1582685 0.29329778 0.24892007 0.22159881
-0.6557496 0.308436399 0.227693111 0.2237660382
-0.49503954 0.3049376 0.23252405 0.22328248
-0.59613234 0.30724597 0.22933967 0.22360271
-0.57882451 0.30687669 0.22984767 0.22355179
-0.59815448 0.30728847 0.22928124 0.22360857
-0.57882451 0.30687669 0.22984767 0.22355179
-0.53785846 0.30596145 0.23110906 0.22342508
-0.64232729 0.3081849 0.22805038 0.22373167
-0.58354629 0.30697843 0.22970767 0.22356583
-0.15826852 0.29329778 0.24892007 0.22159881
0.086472837 0.27660774 0.2735365 0.21898408
0.44117722 0.16052428 0.49649211 0.19316728
0.44186912 0.1588667 0.50050715 0.19267407
0.44453794 0.15060049 0.52094569 0.19014235
  2 commentaires
Mathieu NOE
Mathieu NOE le 25 Avr 2022
hello
what have you tried so far ?
Sanjib
Sanjib le 25 Avr 2022
I tried scatter3 and plot colour bar, but can not plot surface plot ,kindly please help me plotting the surface plot.

Connectez-vous pour commenter.

Réponses (1)

KSSV
KSSV le 25 Avr 2022
A = [-0.5788245 0.30687669 0.22984767 0.22355179
-0.1582685 0.29329778 0.24892007 0.22159881
-0.6557496 0.308436399 0.227693111 0.2237660382
-0.49503954 0.3049376 0.23252405 0.22328248
-0.59613234 0.30724597 0.22933967 0.22360271
-0.57882451 0.30687669 0.22984767 0.22355179
-0.59815448 0.30728847 0.22928124 0.22360857
-0.57882451 0.30687669 0.22984767 0.22355179
-0.53785846 0.30596145 0.23110906 0.22342508
-0.64232729 0.3081849 0.22805038 0.22373167
-0.58354629 0.30697843 0.22970767 0.22356583
-0.15826852 0.29329778 0.24892007 0.22159881
0.086472837 0.27660774 0.2735365 0.21898408
0.44117722 0.16052428 0.49649211 0.19316728
0.44186912 0.1588667 0.50050715 0.19267407
0.44453794 0.15060049 0.52094569 0.19014235];
scatter3(A(:,1), A(:,2), A(:,3),[], A(:,4),'filled')
colorbar
  4 commentaires
Sanjib
Sanjib le 25 Avr 2022
Actually I need continues relationship among them instead of scattered relationship
Sanjib
Sanjib le 25 Avr 2022
I can plot the surface plot for x,y,z but can not introduce m, the 4th variable as colour bar; please check the code
clc;
close all;
clear all;
a=[-0.5788245 0.30687669 0.22984767 0.22355179
-0.1582685 0.29329778 0.24892007 0.22159881
-0.6557496 0.308436399 0.227693111 0.2237660382
-0.49503954 0.3049376 0.23252405 0.22328248
-0.59613234 0.30724597 0.22933967 0.22360271
-0.57882451 0.30687669 0.22984767 0.22355179
-0.59815448 0.30728847 0.22928124 0.22360857
-0.57882451 0.30687669 0.22984767 0.22355179
-0.53785846 0.30596145 0.23110906 0.22342508
-0.64232729 0.3081849 0.22805038 0.22373167
-0.58354629 0.30697843 0.22970767 0.22356583
-0.15826852 0.29329778 0.24892007 0.22159881
0.086472837 0.27660774 0.2735365 0.21898408
0.44117722 0.16052428 0.49649211 0.19316728
0.44186912 0.1588667 0.50050715 0.19267407
0.44453794 0.15060049 0.52094569 0.19014235
];
x=a(:,1:1);
y=a(:,2:2);
z=a(:,3:3);
m=a(:,4:4);
plot3(x,y,z,'.-')
tri = delaunay(x,y);
plot(x,y,'.')
[r,c] = size(tri);
disp(r)
h = trisurf(tri, x, y, z);
% axis vis3d

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by