본문 바로가기

컴퓨터/Matlab

Visualize the electric potential of two charge

반응형
소스코드
N=500;
x=linspace(-1,1,N);
y=linspace(-1,1,N);
[X,Y]=meshgrid(x,y);
C=(9e9)*(10*1e-12)*(ones(N,N)./sqrt(X.^2+(Y-0.1).^2)-ones(N,N)./sqrt(X.^2+(Y+0.1).^2));
pcolor(X,Y,C);
caxis([-1,1]);
shading flat;
사진




반응형