フィルターのクリア

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 Center および File ExchangeSurface 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