필터 지우기
필터 지우기

Attempt to Plot a Coloured Surface to Visualize 4D data.

조회 수: 2 (최근 30일)
Ayden Clay
Ayden Clay 2020년 4월 25일
답변: Ayden Clay 2020년 4월 26일
Hello, I'm attempting to visualize some 4D data in order to understand the toplogy of an optimization problem that I've been set.
I currently have a large matrix, that is size 3600x4. The first 3 values are randomly generated "gains" for a control system, and the last is the "fitness" of the gains determined by running the gains through a dynamic simulation and determining how close those gains get us to a prescribed demand.
Now what I want is to plot out a surface that covers the three gains say [K1, K2, K3] = data(:,1:3); and determine their colour based on the value of the fitness F, with say, F = 0 being red, and F = 1 being green (F is between 0 and 1 not inclusive.)
The code below generates a nearly identical data set.
x = 20*rand(3600,1);
y = 20*rand(3600,1);
z = 20*rand(3600,1);
F = rand(3600,1);
data = [x,y,z,F];
Where for my own eyes I usually follow this with a
topologydata = sortrows(data,size(data,2));
So that I can see if the best fitness is within reasonable bounds. However, you can leave it unsorted if the method that you use prefers or doesn't need it. Realistically, if I can get the plot out the way I'm visualizing it, then I won't need to sort it.
  댓글 수: 2
darova
darova 2020년 4월 26일
What about slice or isosurface?
Ayden Clay
Ayden Clay 2020년 4월 26일
Either of those would absolutely do the trick, and I've since figured out my mistake. Thank you for your suggestions.

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

채택된 답변

Ayden Clay
Ayden Clay 2020년 4월 26일
As the comments have mentioned, slice/isosurface/scatter3/etc. will all do the trick, you can input the three dimensions as the gains and then use the fitness to determine the colour using something like:
m = size(topologydata,1);
green = [0,1,0];
red = [1,0,0];
colors_p = [linspace(red(1),green(1),m)', linspace(red(2),green(2),m)', linspace(red(3),green(3),m)'];
Generates the red -> green colour map.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by