I want to plot this function in matlab : sin(4*x)*cos(4*y)
on a disk
This is how i proceeded :
syms x y;
f=@(x,y) sin(4*x)*cos(4*y);
ezmesh(f,'circ')
This method works with f=@(x,y) sin(2*x)*cos(2*y);
but with a more quickly varying function like f=@(x,y) sin(4*x)*cos(4*y);
ezmesh mistakes these variations for discontinuities. the problem is i can't use the 'circ' parameter and increase the number of points that ezmesh uses at the same time (ezmesh didn't accept it)
Is there any other way ?
I'm not sure if it can be done by adding another parameter. However, if you want a quick-and-dirty way, here you go:
x = -2*pi:0.1:2*pi;
y = -2*pi:0.1:2*pi;
[xx, yy] = meshgrid(x,y);
zz = sin(4*xx).*cos(4*yy);
zz(xx.^2 +yy.^2 >(2*pi)^2) = 0;
surf(xx,yy,zz);
Which produces:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.