plot function f(x,y,z)
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello,
I use meshgrid to get a grid of Cartesian system (x,y,z) (i.e, I get coordinate system represents by 3 matrix X,Y,Z with size nxmxl each). For each point on the grid, I calculate amplitude of electiric field E(x,y,z). I want to plot the amplitude (represents by color), as function of grid point (x,y,z). I have tried to use surf, but it has not work.
my code:
lambda =0.3;
x = linspace(0.02,2,100);
y = linspace(0.02,2,100);
z = linspace(0.02,2,100);
[X, Y, Z] = meshgrid(x,y,z);
R = sqrt(X.^2+Y.^2+Z.^2);
tetha = acos(Z./R);
k = 2*pi/lambda;
E = real(1i*exp(1i*k*R)./(4*pi*R).*sin(tetha).*(2*sin(5*pi.*(cos(tetha)-1)))./(cos(tetha)-1));
Thank you!
댓글 수: 2
flavio tollini
2019년 11월 19일
One way to visualize it can be using volumetric plots (representing 4th dimension as color intensity)
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!