plot 5 indipendent vectors in 3D plot

조회 수: 1 (최근 30일)
Francesco Porretta
Francesco Porretta 2021년 9월 4일
답변: darova 2021년 9월 8일
I have 5 vectors of related elements, in the sense that the first element of vector A is connected to the first elements of vectors B, C, D, E, the second with the seconds, and so on: they represents the x, y, z, phi and delta coordinates of points.
I'm searching for a way to plot this vectors as surface plot or scatterplot, but I really don't know if it is possible to do.
Someone can help??
  댓글 수: 2
darova
darova 2021년 9월 5일
Please explain more: how the vectors are connected? Can you attach some picture or data?
Francesco Porretta
Francesco Porretta 2021년 9월 8일
okay, sorry. Let's make an example:
x = [1 2 3]
y = [4 5 6]
z = [7 8 9]
phi = [0 30 0]
delta = [1 3 5]
x, y, z and phi represent the coordinates of 3 points, and delta their characteristics. For example, the point [x,y,z,phi] = [1,4,7,0] has characteristic delta = 1.
I'm searching for a way for rapresents the 3 points and their respective characteristics as a surface, where the colour represents the caracteristic of each point on this surface.
Hoping it is more clear, I'm sorry, it is my fault.

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

채택된 답변

darova
darova 2021년 9월 8일
Just use griddata to interpolate data
Delta is represented by color.
x = 20*rand(100,1)-10; % surface coordinates
y = 20*rand(100,1)-10;
r = hypot(x,y);
z = -r.^2/10;
delta = sin(r); % surface color (characteristic)
xx = linspace(min(x),max(x),50);
yy = linspace(min(y),max(y),50);
[X,Y] = meshgrid(xx,yy); % create a mesh
Z = griddata(x,y,z,X,Y); % interpolate Z coord
D = griddata(x,y,delta,X,Y);% interpolate delta
scatter3(x,y,z,25,delta,'filled')
surface(X,Y,Z,D,'facecolor','interp')
axis equal
colorbar

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by