0

I have 4 matrices, X, Y, Z & CL. All matrices are 3 x 3 x 3.

I want to plot a 3d surface chart using the surf function. So for example is we say X is the atmospheric pressure, Y is the longitude, Z is altitude & CL is the rainfall. I want the chart to look something like this chart where the colour would represent the rainfall.

surf(X, Y, Z, CL);

I get the error message below. I don't understand what I am doing wrong?

Error using matlab.graphics.chart.primitive.Surface/set

Value must be a vector or 2D array of numeric type

Community
  • 1
  • 1
mHelpMe
  • 6,336
  • 24
  • 75
  • 150
  • 1
    The input arrays of [surf](https://www.mathworks.com/help/matlab/ref/surf.html) shall be 2D arrays while you using 3D arrays as input. You can check this example: `[x,y,z]=peaks(33);CL=rand(33,33);surf(x,y,z,CL)`, With a 3D input arrays perhaps you can plot 3 surface. – il_raffa May 26 '20 at 16:43
  • You may have [Volumetric data](https://stackoverflow.com/questions/27659632/plotting-volumetric-data-in-matlab/27660039#27660039). Is that correct? – Ander Biguri May 26 '20 at 19:05

0 Answers0