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

  • Thread starter Thread starter JoshHolloway
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The user is attempting to graph the equation z = x^2 + (xy) in MATLAB but is encountering issues. The provided code has a minor syntactical error where the multiplication operator is incorrectly formatted as X. * Y.; instead of X.*Y. The rest of the code appears to be correct for generating a mesh plot. Users suggest correcting the syntax and confirm that the overall approach is valid. Proper syntax is crucial for successful execution in MATLAB.
JoshHolloway
Messages
221
Reaction score
0
I want to graph the equation z = x^{2} + (xy) 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
Anyone?
 
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
 

Similar threads

Replies
4
Views
1K
Replies
5
Views
3K
Replies
1
Views
2K
Replies
4
Views
2K
Replies
1
Views
4K
Replies
4
Views
2K
Back
Top