plot surface 3d from table

5 views (last 30 days)
mohamdi mohamed
mohamdi mohamed on 22 Sep 2023
Commented: Dyuman Joshi on 22 Sep 2023
hi everyone
i have this table
0.04 0.06 0.08 0.1 0.12 0.15
20 1112 1239 1349 1432 1505 1629
16 1003 1115 1195 1264 1322 1415
10 836.3 917.3 978.6 1035 1075 1145
8 782.7 840.1 904 954 996 1056
7 734.9 804.1 864.1 911.7 949.8 1015
5 836.3 721 772.4 815.1 859.5 922.4
i want the same plot in matlab
surface 3d
can some one help me

Accepted Answer

Dyuman Joshi
Dyuman Joshi on 22 Sep 2023
Import the data, assign the first column as x data, top row as y data (or vice-versa, depending upon how you define the axis) and the remaining matrix as the z data, and then use surf.
%That would look like
x = [20 16 10 8 7 5];
y = [0.04 0.06 0.08 0.1 0.12 0.15];
z = [1112 1239 1349 1432 1505 1629;
1003 1115 1195 1264 1322 1415;
36.3 917.3 978.6 1035 1075 1145;
782.7 840.1 904 954 996 1056;
734.9 804.1 864.1 911.7 949.8 1015;
836.3 721 772.4 815.1 859.5 922.4 ];
surf(x,y,z)
set(gca,'XDir','reverse', 'YDir', 'reverse')
view([45 45])

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!