3D Plot with Four Variables

2 vues (au cours des 30 derniers jours)
Yaser Khojah
Yaser Khojah le 24 Sep 2018
Modifié(e) : Yaser Khojah le 24 Sep 2018
Hello, I have four variables (Demand, NPV_all, STD_all, STD_In) and I would like to plot them in a 3D plot. I have created the plot but for some reason I can not show the legend. Can anyone help please.
if true
Demand = rand(7,3);
NPV_all = rand(7,3);
STD_all = rand(7,3);
STD_In = [0.25 .5 .75] .* ones(7,3);
Demand_V = Demand(:);
NPV_V = NPV_all(:);
STD_V = STD_All(:);
STD_In_V = STD_In(:);
h = scatter3(Demand_V,STD_V,NPV_V,markerSize,STD_In_V,'filled');
title('Economic Impact of Production Profile')
xlabel('Demand [MMSCFD]')
ylabel('STD [$B]')
zlabel('NPV [$B]')
legend('STD = 0.25', 'STD = 0.50','STD = 0.75');
end

Réponse acceptée

KSSV
KSSV le 24 Sep 2018
Demand = rand(7,3);
NPV_all = rand(7,3);
STD_all = rand(7,3);
STD_In = [0.25 .5 .75] .* ones(7,3);
Demand_V = Demand(:);
NPV_V = NPV_all(:);
STD_V = STD_all(:);
STD_In_V = STD_In(:);
markerSize = 10 ;
STD = [0.25 0.50 0.75] ;
figure
hold on
for i = 1:length(STD)
idx = abs(STD_In_V-STD(i))<=10^-3 ;
h = scatter3(Demand_V(idx),STD_V(idx),NPV_V(idx),markerSize,STD_In_V(idx),'filled');
end
title('Economic Impact of Production Profile')
xlabel('Demand [MMSCFD]')
ylabel('STD [$B]')
zlabel('NPV [$B]')
legend('STD = 0.25', 'STD = 0.50','STD = 0.75');
  1 commentaire
Yaser Khojah
Yaser Khojah le 24 Sep 2018
Modifié(e) : Yaser Khojah le 24 Sep 2018
Thanks so much for your help and that is what I was looking for. Would it be possible to connect these dots? For example all the dots belong to 0.25?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Objects dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by