problem using mesh, only ezmesh works

I have a problem when I try to use mesh, I get the wrong graph for my function. But when i use ezmesh insted, I get the correct graph. How can i solve this so I get the same result with mesh as I get with ezmesh? Does it have something to do with the elementwise operation?
x=-3:0.1:3;
y=-3:0.1:3;
[x1,y1] = meshgrid(x,y);
f1=((x1.^3)*(y1+5*x1.^2)*(y1.^2))./(exp(x1.^2)+3*(y1.^4));
mesh(x1,y1,f1)
figure()
hold on;
syms x y;
ezmesh((((x^3)*y)+(5*(x^2)*(y^2)))/(exp(x^2)+3*y^4)),[-3,3,-3,3]

Answers (1)

The function that you are ezmesh() is not the same as the function you calculate in f1.
The f1 that is equivalent to what you ezmesh is
f1 = ((x1.^3.*y1)+(5*x1.^2).*(y1.^2))./(exp(x1.^2)+3*(y1.^4))
Notice the difference in * (algebraic matrix multiplication) compared to .* (element-by-element multiplication) and the difference in x^3*y + something * y^2 compared to x^3*(y+something) * y^2

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Tags

Asked:

on 24 Mar 2018

Answered:

on 24 Mar 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!