norm function in for loop in Matlab -


is there way write below code in matlab without loop?

for g=1:nn     u(g)=uu(g)/norm(uu(g),vv(g));     v(g)=vv(g)/norm(uu(g),vv(g)); end 

if vector, can point division:

 mat = [uu.' vv.'];  norms = arrayfun(@(idx)norm(mat(idx,:)),1:length(uu)); % post https://www.mathworks.com/matlabcentral/newsreader/view_thread/172116  %or instead norms = sqrt(uu.^2 + vv.^2);  u = uu ./ norms;  v = vv ./ norms; 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -