3d plot help

1 回表示 (過去 30 日間)
AHMED FAKHRI
AHMED FAKHRI 2019 年 8 月 21 日
コメント済み: Star Strider 2019 年 8 月 21 日
Hi,
I have the file attached which contain the following information:
1-Time of the year : 30:30:360 (each month increment)
2-Revenue at each time of the year (12 data )
3- The cost at each state of charge (5*12 data)
I need to 3d plot the Time at x-axis , cost at y-axis and Profit = revenue - cost at y-axis
I could'nt do that when looked into the surf function, can you please help ?
I 3d plotted the Time, Revenue and Profit as below but I am not convinced they descirbe what is going
untitled.jpg

採用された回答

Star Strider
Star Strider 2019 年 8 月 21 日
The description ‘Time at x-axis , cost at y-axis and Profit = revenue - cost at y-axis’ describes a 2D plot.
Try this:
D = xlsread('myfile.xlsx');
Time = D(:,1);
Revenuev = D(:,2);
Costmtx = D(:,3:end);
Profit = Revenuev - Costmtx;
figure
plot(Time, Costmtx)
hold on
plot(Time, Profit, '--')
hold off
grid
xlim([0 500])
Cc = sprintfc('Cost%d', 1:5);
Pc = sprintfc('Profit%d',1:5);
legend([Cc, Pc], 'Location','E')
A 3D version:
figure
plot3((Time*ones(1,5)), Costmtx, Profitmtx)
grid on
xlabel('Time')
ylabel('Cost')
zlabel('Profit')
view(15,15)
legend('1','2','3','4','5')

その他の回答 (1 件)

AHMED FAKHRI
AHMED FAKHRI 2019 年 8 月 21 日
Thanks @Star Strider
at the end I plotted the 2D version which makes sense more, Time, Revenue and Cost.
  1 件のコメント
Star Strider
Star Strider 2019 年 8 月 21 日
As always, my pleasure!

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

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by