×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Mesh Plots using 3 Vectors

Mesh Plots using 3 Vectors

Mesh Plots using 3 Vectors

(OP)
Hi All,

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

RE: Mesh Plots using 3 Vectors

Hi,
I thing, everything goes well as you suggested...
X=[1:1:4];
Y=X;
Z=[30 20 20 30; 20 10 10 20; 20 10 10 20; 30 20 20 30];
[X1,Y1]=meshgrid(X,Y);
mesh(X1,Y1,Z);

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources