Spatial, coloured vectors

조회 수: 5 (최근 30일)
Mario
Mario 2025년 5월 27일
댓글: Star Strider 2025년 5월 28일
Hello!
My question would consist of both a static and a time-changing plot (animation).
Static part: (It will be closely related to the time-changing part)
My initial data types are:
xyz -> this is a matrix with rows containing the starting points of the vectors.
B -> this is a cell array containing the directions u, v, and w from the vectors' starting points in the form of a column vector.
C -> this contains the magnitude of each vector in turn.
For data, a brief example:
xyz = [1,0,0; 1,1,1; 1,0,1];
B = {[50,-2,5]; [23,-51,65]; [1,-6,-88]};
C = [52.29, 85.76, 88.21];
The task here would be to draw spatial arrows colored by their size.
I tried to use the following method to colour the vectors, but other methods might work as well:
RGB = [0 0 1
0 0.5 1
0 1 1
0 1 0.5
0 1 0
0.5 1 0
1 1 0
1 0.5 0
1 0 0 0];
colormap(RGB);
An important note for this exercise is that my input data is always in this format and I usually have to plot thousands of arrows like this.
Dynamic part:
Here you have to create an animation such that the matrix xyz is unchanged, but the matrix B and hence the matrix C calculated from it changes step by step.
At some point there are hundreds of steps in succession.
Thanks for your help!
  댓글 수: 2
Image Analyst
Image Analyst 2025년 5월 27일
That is not a method. It's just a colormap. C are your vector lengths, but what color goes with what length? Does each row in RGB correspond to a certain length? If so, which ones?
Mario
Mario 2025년 5월 27일
The RGB matrix and a colormap is just an example, how I'd like to color the vectors based on ther magnitude.
It is just an idea but not an essential part. It okex with another coloring methods as well.

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

채택된 답변

Star Strider
Star Strider 2025년 5월 27일
The quiver3Dpatch File Exchange contribution can probably do what you want. You will need to use the usual quiver3 argument format for your data, instead of your current format.
  댓글 수: 4
Mario
Mario 2025년 5월 28일
It works!
Thank yout! :)
Star Strider
Star Strider 2025년 5월 28일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by