histogram for every loop

3 visualizzazioni (ultimi 30 giorni)
SINDU GOKULAPATI
SINDU GOKULAPATI il 16 Mag 2021
Risposto: Hrishikesh Borate il 28 Mag 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')

Risposte (1)

Hrishikesh Borate
Hrishikesh Borate il 28 Mag 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

Categorie

Scopri di più su Graph and Network Algorithms in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by