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
- 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.
- viscircles is not defined is another error. What do I use to replace viscicles.
- 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
Gradx[j]=W[j]*(x0-x[j])/Norm[j]; # gradiaent in x-direction
Grady[j]=W[j]*(y0-y[j])/Norm[j]; # gradiaent in y-direction
end
Tx=sum(Top)/sum(Bottom)
Gradx=sum(Gradx)
Grady=sum(Grady)
SatBarx=(sum(S))^(-1)
NewX=Xk-[SatBarx*Gradx, SatBarx*Grady]
count=0