# histogram for every loop

5 views (last 30 days)
SINDU GOKULAPATI on 16 May 2021
Answered: Hrishikesh Borate on 28 May 2021
i have set of normalised points [x,y,z] (rnorm)[ i have attached 50 values as a csv file below] , i need histogram of each point wrt the angle it has from other points
angle = transpose(rnorm{i})*rnorm{j}; //used this for angle
if angle > cosd(20) && angle < cosd(0) // for angle condition
how do i get histogram withrespect to each point ?
ur help is appretiated thanks
ps: for i=1:n
for j=1:n
angle = transpose(rnorm{i})*rnorm{j};
if angle > cosd(20) && angle < cosd(0)
im struck here (im not finding a way to store the angles accumulated )(basically to get histogram for every loop of 'i')

Hrishikesh Borate on 28 May 2021
Hi,
It’s my understanding that you are attempting to store all the angles satisfying the condition for every iteration. Following is the code for the same:-
% The allAngle array is used to store all the angles satisfying the condition.
allAngle = [];
for i=1:size(rnorm,1)
angle = sum(repmat(rnorm(i,:),size(rnorm,1),1).*rnorm,2);
idx = angle > cosd(20) & angle < cosd(0);
angle = angle(idx);
allAngle = [allAngle;angle];
% Perform computation on the angle array from here.
end