function Plot_Poisson_Equation(n)
A = zeros(n-1,n-1)
for i in 1:n-2
A[i,i+1] = -1
A[i,i] = 2
A[i+1,i] = -1
end
end
Hello Im still gettin Erro A, and u not defined, can someone help me please?
oheil
2
Looks good to me:
julia> function Plot_Poisson_Equation(n)
A = zeros(n-1,n-1)
for i in 1:n-2
A[i,i+1] = -1
A[i,i] = 2
A[i+1,i] = -1
end
A
end
Plot_Poisson_Equation (generic function with 1 method)
julia> Plot_Poisson_Equation(10)
9×9 Array{Float64,2}:
2.0 -1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
-1.0 2.0 -1.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 -1.0 2.0 -1.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 -1.0 2.0 -1.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 -1.0 2.0 -1.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 -1.0 2.0 -1.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 -1.0 2.0 -1.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 -1.0 2.0 -1.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 -1.0 0.0
1 Like