Hi,(adsbygoogle = window.adsbygoogle || []).push({});

I realise this is a physics forum, but thought someone may be able to help!

I would like to create a square array i.e 4x4 and then plot a vector of data (16 elements) over this 4x4 array.

I have created the following code, it doesnt work but thats what I am ideally aiming after:

[X,Y] = meshgrid([1:1:4]);

z = [30 20 20 30 20 10 10 20 20 10 10 20 30 20 20 30];

mesh(X,Y,z)

The reason that I believe that it doesnt work is that my z variable is not a funtion of X or Y. But it isn't in real life so how do I get around this?

Regards

Tom

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Create a square array in matlab

Loading...

Similar Threads for Create square array | Date |
---|---|

MATLAB How to create distinct circles in Matlab? | May 11, 2017 |

Create track map using Lateral acceleration & speed in Matlab | Mar 11, 2016 |

How to create a matrix with variables? | Jan 28, 2016 |

**Physics Forums - The Fusion of Science and Community**