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] = 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…)