Clear Filters
Clear Filters

How to plot a Matrix?

1 view (last 30 days)
Helen
Helen on 29 Aug 2013
I need to use this data to plot a 3D graph.
G= 0.2520 1.5600 16.3764
0.2880 1.4400 -44.7900
0.3600 0.9600 -40.2200
0.3240 1.0800 -59.6300
0.3600 1.5600 44.5400
0.2880 0.8400 41.8400
0.2880 0.9600 36.4000
0.2880 1.0800 32.6300
0.2880 1.2000 30.8600
0.2000 0.1320 29.2600
0.2880 1.5600 26.9500
0.2880 1.6800 26.6700
0.2520 0.9600 21.2100
0.2520 0.8400 29.5100
0.2520 1.0800 4.5800
0.2520 1.2000 25.5700
0.2520 1.3200 20.4770
0.2520 1.4400 16.7613
0.2520 1.5600 16.4656
0.2520 1.6800 18.0860
0.3240 0.8400 19.9200
0.3240 0.9600 34.8300
0.3240 1.0800 42.8000
0.3240 1.2000 40.2500
0.3240 1.3200 38.8000
0.3240 1.4400 37.9700
0.3240 1.5600 37.5800
0.3240 1.6800 37.4500
0.3600 0.8400 30.5400
0.3600 0.9600 23.3500
0.3600 1.0800 0.0400
0.3600 1.2000 42.0200
0.3600 1.3200 46.1500
0.3600 1.4400 45.1500
0.3600 1.5600 44.5000
0.3600 1.6800 44.1500
0.3960 0.8400 30.3200
0.3960 0.9600 37.2700
0.3960 1.0800 28.0700
0.3960 1.2000 8.0170
0.3960 1.3200 4.4500
0.3960 1.4400 19.5600
0.3960 1.5600 37.0700
0.3960 1.6800 45.8700
0.4320 0.8400 30.7000
0.4320 0.9600 33.2700
0.4320 1.0800 38.1800
0.4320 1.2000 65.7500
0.4320 1.3200 26.0300
0.4320 1.4400 0.0900
0.4320 1.5600 31.1000
0.4320 5.6800 14.3590
0.4680 0.8400 31.3100
0.4680 0.9600 31.7800
0.4680 1.0800 20.7600
0.4680 1.2000 40.2800
0.4680 1.3200 35.5400
0.6800 1.4400 32.4600
0.4680 1.5600 29.1900
0.4680 1.6800 23.8200
0.5040 0.8400 31.8400
0.5040 0.9600 31.6700
0.5040 1.0800 31.5300
0.5040 1.2000 42.9300
0.5040 1.3200 42.7900
0.5040 1.4400 38.9000
0.5040 1.5600 36.4700
0.5040 1.6800 34.6600

Answers (2)

Azzi Abdelmalek
Azzi Abdelmalek on 29 Aug 2013
plot3(G(:,1),G(:,2),G(:,3))
  2 Comments
Helen
Helen on 29 Aug 2013
Thank you! How do I turn this plot into a 'map' or a 'surface'?
Azzi Abdelmalek
Azzi Abdelmalek on 29 Aug 2013
There are missing data, I don't know if you can interpolate with interp2 function

Sign in to comment.


Markus
Markus on 29 Aug 2013
use the meshgrid, griddata, surf:
[xi yi]= meshgrid(min(G):0.05:max(G),min(G):0.05:max(G);
zi = griddata(x,y,z, xi,yi,'linear');
surf(xi,yi,zi)
i hope, i have no typo in it.
  2 Comments
Helen
Helen on 29 Aug 2013
It say that x,y and z are undefined, how do I solve this? There is probably something really obvious I am missing!
Markus
Markus on 30 Aug 2013
Edited: Markus on 30 Aug 2013
this should work:
[xG yG]= meshgrid(min(G):0.05:max(G),min(G):0.05:max(G));
zG=griddata(G(:,1),G(:,2),G(:,3),xG,yG);
surf(xG,yG,zG)
or:
[xG yG]= meshgrid(G(:,1),G(:,2));
zG=griddata(G(:,1),G(:,2),G(:,3),xG,yG);
surf(xG,yG,zG)
this does make only sense as long as the data are xy koordinates with a z value.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!