Graphing z=x^2+(xy) in Matlab: What am I Doing Wrong?

  • Context: MATLAB 
  • Thread starter Thread starter JoshHolloway
  • Start date Start date
  • Tags Tags
    Matlab
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 3K views
JoshHolloway
Messages
221
Reaction score
0
I want to graph the equation [tex]z = x^{2} + (xy)[/tex] in matlab, but I can't figure out how to do it.

Here is the code I am trying:

EDU>> [X,Y] = meshgrid(-10:.5:10);
EDU>> Z = X.^2 + X. * Y.;
EDU>> mesh(X,Y,Z, 'EdgeColor', 'black')


What am I doing wrong?
 
Physics news on Phys.org
What makes you think you're doing something wrong?

I can see one syntactical mistake (X. * Y.; should be X.*Y;) but otherwise it looks ok