histogram for every loop

1 Ansicht (letzte 30 Tage)
SINDU GOKULAPATI
SINDU GOKULAPATI am 16 Mai 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')

Antworten (1)

Hrishikesh Borate
Hrishikesh Borate am 28 Mai 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:-
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

Community Treasure Hunt

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

Start Hunting!

Translated by