histogram for every loop
3 views (last 30 days)
Show older comments
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')
0 Comments
Answers (1)
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:-
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
0 Comments
See Also
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!