surfC with 4 vectors
    5 views (last 30 days)
  
       Show older comments
    
Hello, Quick question : is it possible to make surfc works with vectors ? I have 4 vectors (x,y,z & c for the color) of the same length (1 point per quadruple xyzc ) but I don't understand how to turn them into matrix as surfc asks me. The xyz points are uniformly spaced. Any idea ?
0 Comments
Accepted Answer
  Grzegorz Knor
      
 on 28 Sep 2011
        Use reshape function, or interpolate the data:
5 Comments
  Grzegorz Knor
      
 on 28 Sep 2011
				Matrices can be any size, but you need to know it.
[x,y] = meshgrid(-2:.1:2, -2:.2:2);
x = x(:);
y = y(:);
z = x.*exp(-x.^2 - y.^2); 
c = abs(z);
surfc(reshape(x,21,41),reshape(y,21,41),reshape(z,21,41),reshape(c,21,41))
More Answers (0)
See Also
Categories
				Find more on Surface and Mesh Plots in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!