3D Scatterplot and Pareto Front visualization

Hey,
So first things first, I'm really new in MatLab and even though I'm trying to learn the bassics in order to do what I want and udenrstand it, it seems like it is hard when you are under schedule.
I've Uploaded an excel file with all my data ( 525 rows and 3 columns) and then I created my workspace. After that I defined my x's,y's and z's using the following commands.
numbers = xlsread(filename);
x = numbers(1:525,3);
y = numbers(1:525,2);
z = numbers(1:525,1);
I tried following this answer ( https://www.mathworks.com/matlabcentral/answers/110723-is-it-possible-to-generate-surface-pareto-front-for-3-objective-functions-and-plot-it) but I had no luck - the first reason was because I couldn'y understand what a,b and c were and how they were related to my data.
So my question is, how do I create a 3d scatterplot were I can also create a visible Pareto front?
Thanks in advance!

回答 (1 件)

Alan Weiss
Alan Weiss 2021 年 4 月 12 日

0 投票

Did you try the scatteredinterpolant code from the answer? Modify it for your data:
F = scatteredInterpolant(numbers(:,1),numbers(:,2),numbers(:,3),'linear','none');
sgr = min(f(:,1)):.01:max(f(:,1));
ygr = min(f(:,2)):.01:max(f(:,2));
[XX,YY] = meshgrid(sgr,ygr);
ZZ = F(XX,YY);
surf(XX,YY,ZZ,'LineStyle','none')
Alan Weiss
MATLAB mathematical toolbox documentation

5 件のコメント

Apostolos Fragkalas
Apostolos Fragkalas 2021 年 4 月 12 日
First of all, thanks for the reply.
So when I'm typing the command and If I modify the data correctly, I ge this
F = scatteredInterpolant(numbers(1:525,1),numbers(1:525,2),numbers(1:525,3),'linear','none');
sgr = min(f(1:525,1)):.01:max(f(1:525,1));
ygr = min(f(1:525,2)):.01:max(f(1:525,2));
[XX,YY] = meshgrid(sgr,ygr);
ZZ = F(XX,YY);
surf(XX,YY,ZZ,'LineStyle','none')
Unrecognized function or variable 'f'.
Did you mean:
sgr = min(F(1:525,1)):.01:max(F(1:525,1));
Error using scatteredInterpolant/subsref
The input data has inconsistent size.
Alan Weiss
Alan Weiss 2021 年 4 月 12 日
Sorry, I answered too quickly.
Replace f with numbers everywhere.
sgr = min(numbers(1:525,1)):.01:max(numbers(1:525,1));
ygr = min(numbers(1:525,2)):.01:max(numbers(1:525,2));
Alan Weiss
MATLAB mathematical toolbox documentation
Apostolos Fragkalas
Apostolos Fragkalas 2021 年 4 月 12 日
It gives me the following, maybe it's because I'm using the MatLab Online version?
F = scatteredInterpolant(numbers(1:525,1),numbers(1:525,2),numbers(1:525,3),'linear','none');
sgr = min(numbers(1:525,1)):.01:max(numbers(1:525,1));
ygr = min(numbers(1:525,2)):.01:max(numbers(1:525,2));
[XX,YY] = meshgrid(sgr,ygr);
ZZ = F(XX,YY);
surf(XX,YY,ZZ,'LineStyle','none')
Requested 1042580574x1 (7.8GB) array exceeds maximum array size preference (5.0GB). This might cause MATLAB to become unresponsive.
Alan Weiss
Alan Weiss 2021 年 4 月 12 日
Sorry, my original code was for numbers on the order of 1, your data might be different. This code should be independent of the scale:
sgr = linspace(min(numbers(1:525,1)),max(numbers(1:525,1)));
ygr = linspace(min(numbers(1:525,2)),max(numbers(1:525,2)));
Alan Weiss
MATLAB mathematical toolbox documentation
Apostolos Fragkalas
Apostolos Fragkalas 2021 年 4 月 12 日
編集済み: Apostolos Fragkalas 2021 年 4 月 12 日
So the full and revised code is this. The minor changes were made to correspond with my data
F = scatteredInterpolant(numbers(1:525,2),numbers(1:525,3),numbers(1:525,1),'linear','none');
sgr = linspace(min(numbers(1:525,2)),max(numbers(1:525,2)));
ygr = linspace(min(numbers(1:525,3)),max(numbers(1:525,3)));
[XX,YY] = meshgrid(sgr,ygr);
ZZ = F(XX,YY);
surf(XX,YY,ZZ,'LineStyle','none')
Warning: Duplicate data points have been detected and removed - corresponding values have been averaged.
If I exclude the "Warning" messege, everything else seems to be looking great to be honest!
However, I do have some followup questions. Is there a way wher I can have the data combination that give me the Pareto Front, in a more vivid color, and the rest of data combination shown too? You know, like dots. I don't know if I'm explaining what I want to say the right way.
Also, is there a way to know the optimal solution based on the formula that calucmates the distance between two points (d = ((x2 - x1)2 + (y2 - y1)2 + (z2 - z1)2)1/2) ?
Thanks in advance!

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeGraphics Performance についてさらに検索

質問済み:

2021 年 4 月 11 日

編集済み:

2021 年 4 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by