반응형
소스코드
clear all;
d=1;
Nx=100;
dx=d/Nx;
V0=0;
V1=2;
N=5000;
V=zeros(Nx+1);
V(1)=V0;
V(Nx+1)=V1;
for n=1:1:N
for i=2:1:Nx
V(i) = (V(i+1)+V(i-1))/2;
end
end
x=[0:dx:d];
figure();
plot(x,V);
이미지
(준비중...)
반응형
'컴퓨터 > Matlab' 카테고리의 다른 글
| Solve Poisson Equation Using FDM (In Cartesian Coordinate) (0) | 2015.10.28 |
|---|---|
| x방향 수치 미분 값을 pcolor (0) | 2015.10.18 |
| Visualize the electric potential of two charge (0) | 2015.10.18 |