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

조회 수: 2 (최근 30일)
Sanjib
Sanjib 2022년 4월 25일
댓글: Sanjib 2022년 4월 25일
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
Mathieu NOE
Mathieu NOE 2022년 4월 25일
hello
what have you tried so far ?
Sanjib
Sanjib 2022년 4월 25일
I tried scatter3 and plot colour bar, but can not plot surface plot ,kindly please help me plotting the surface plot.

댓글을 달려면 로그인하십시오.

답변 (1개)

KSSV
KSSV 2022년 4월 25일
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
Sanjib
Sanjib 2022년 4월 25일
Actually I need continues relationship among them instead of scattered relationship
Sanjib
Sanjib 2022년 4월 25일
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

댓글을 달려면 로그인하십시오.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by