# Undefined Variable

**URL:** <https://discourse.julialang.org/t/undefined-variable/42416>\
**Category:** Performance\
**Created:** [July 2, 2020, 8:18am UTC](https://discourse.julialang.org/t/undefined-variable/42416 "2020-07-02T08:18:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hyacykcharel](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@hyacykcharel](https://discourse.julialang.org/u/hyacykcharel)\
**Post date:** [July 2, 2020, 8:18am UTC](https://discourse.julialang.org/t/undefined-variable/42416/1 "2020-07-02T08:18:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [July 2, 2020, 8:25am UTC](https://discourse.julialang.org/t/undefined-variable/42416/2 "2020-07-02T08:25:06Z")

</div>

Looks good to me:

```julia
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

```
