surfPlot(data,varar​gin)

Version 1.2.0.0 (1.02 KB) by Ambroise
Use surf function easily from a data matrix
116 Downloads
Updated 14 Jul 2015

View License

The surf function requires a certain variable format. here is a function that allows you to plot data from a n*3 matrix using the surf function.
to be used for example with a data matrix of the form [time, position, temperature] or [position in x, position in y, concentration]
Help of the function:
surf plot from [x, y, z] data
data is in the form data = [x, y, z]; where x, y, and z are column vectors
This code works for an input dataset were x and y are like the following :
x only contains n values
y only contains m values
x contains m times all the different n values => length(x)=m*n
y contains n times all the different m values => length(y)=n*m
z contains the corresponding z value for each of those (x;y) points
=> length(z) = m*n
Example : (notice that x is either 1,2 or 3, y is 1,2,3 or 4)
data= [1 1 4.5;...
1 2 5 ;...
1 3 6;...
1 4 7;...
2 1 4.6;...
2 2 5.3;...
2 3 6.4;...
2 4 7.1;...
3 1 5;...
3 2 6;...
3 3 7;...
3 4 8];

Cite As

Ambroise (2024). surfPlot(data,varargin) (https://www.mathworks.com/matlabcentral/fileexchange/51097-surfplot-data-varargin), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: sub images

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.2.0.0

h=surfPlot(data) returns now a handle to a chart surface graphics object.
Optional options for surf now supported

1.1.0.0

more efficient code, shorter, thanks to Stephen

1.0.0.0