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

1 Ansicht (letzte 30 Tage)
Ayden Clay
Ayden Clay am 25 Apr. 2020
Beantwortet: Ayden Clay am 26 Apr. 2020
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 Kommentare
darova
darova am 26 Apr. 2020
What about slice or isosurface?
Ayden Clay
Ayden Clay am 26 Apr. 2020
Either of those would absolutely do the trick, and I've since figured out my mistake. Thank you for your suggestions.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Ayden Clay
Ayden Clay am 26 Apr. 2020
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.

Weitere Antworten (0)

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by