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!