Azzera filtri
Azzera filtri

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

2 visualizzazioni (ultimi 30 giorni)
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 Commenti
Ayden Clay
Ayden Clay il 26 Apr 2020
Either of those would absolutely do the trick, and I've since figured out my mistake. Thank you for your suggestions.

Accedi per commentare.

Risposta accettata

Ayden Clay
Ayden Clay il 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.

Più risposte (0)

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by