histogram for every loop

1 次查看(过去 30 天)
SINDU GOKULAPATI
SINDU GOKULAPATI 2021-5-16
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')

回答(1 个)

Hrishikesh Borate
Hrishikesh Borate 2021-5-28
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:-
rnorm = readmatrix('rnorm.csv');
% 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

类别

Help CenterFile Exchange 中查找有关 Graph and Network Algorithms 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by