# Viscircles and Norm not defined

I Keep getting this 3 errors with my code. I made some search to correct them but the options are not working. I will be glad if anyone can give me some guidance, please. this are my errors

1. The “hold on” for plots is not working in Julia so I used plot!() but am not getting any results. What can I use to replace hold on for plots in Julia.
2. viscircles is not defined is another error. What do I use to replace viscicles.
3. I have Norm[j]=norm(Xk-[x[j],y[j]]) which I see it to be defined but I keep getting Norm is not defined.

How do I correct this please. Any help will be greatly appreciated please. Thank you.

``````using PyPlot
using Plots
pyplot()
using LinearAlgebra, BenchmarkTools

n=7
W=[4 3 5 6 7 6 5]
x=[33 15 2 5 39 17 11]
y=[41 11 4 45 3 26 4]
plot(x,y, "ko")
hold on

x-y
c=W.*(x-y)
d = norm(c) # this is two norm()
x0=sum(W.*x)/sum(W)
y0=sum(W.*y)/sum(W)
Xk=[x0,y0]

for r=10:30:30
viscircles[[x0,y0],r]
plot(x0,y0, "kv")
hold on
end

for j=1:n
Norm[j]=norm(Xk-[x[j],y[j]]);# calculate the distance from the initial point to all other points, 2-norm()
Top[j]=W[j]*x[j]/Norm[j]; # top of 2.5
Bottom[j]=W[j]/Norm[j];# bottom of 2.5
S[j]=W[j]/Norm[j]; # 2.8
end

Tx=sum(Top)/sum(Bottom)
SatBarx=(sum(S))^(-1)

count=0

``````
1. Plots are displayed when the code you are evaluating returns a plot object. You are plotting in a loop and looks return `nothing` in Julia. You need to call `current()` after your loop to display the plot.
2. You need to tell people what `viscircles` is. There is no reason to expect that any random Matlab function exists in Julia, or that people know what Matlab functions do.
3. You are not defining `Norm` in your code, so it is undefined. Julia is case sensitive so `Norm` is not the same as `norm`. As a general piece of advice it is not a good idea to define objects which share the name of built in functions like `norm`, as you can easily overwrite them and break your program, also it makes your code harder to reason about when names don’t mean what they normally mean.

One difference to MATLAB is that you need to define arrays before you can write into them.
For example, if you add this line before the for loop, the second error will probably disappear:

``````Norm = zeros(n)
``````

(This is because Julia doesn’t assume that a line like `Norm = 1.0` should create a new vector if it doesn’t exist already. This is because the syntax could also represent many other things in Julia (such as a `Dict` etc…)