Invalid use of operator while trying to plot surface
Show older comments
I am a total rookie when it comes to MatLab so I got stuck right away when trying to plot a surface. I get the "invalid use of operator" error code when trying to write the expression for Z, which is supposed to look something like this: z=(4x^2+8xy-2y^2)e^{-(x^2+2y^2)}. MatLab seems to point out that the minus sign in front of the 2 is the issue. How should I code the expression?
>> x=linspace(-3,3);
y=linspace(-2,2);
[X,Y]=meshgrid(x,y);
Z=(4*X.^2+8*X.*Y.-2*Y.^2)*exp^-(X.^2+2Y.^2);
↑
Invalid use of operator.
Thanks in advance!
Accepted Answer
More Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!