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]
回答(1 个)
Walter Roberson
2018-3-24
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
类别
在 帮助中心 和 File Exchange 中查找有关 Operators and Elementary Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!