compute iterations to calculate pairs of data that do not repeat

조회 수: 2 (최근 30일)
P_L
P_L 2019년 4월 16일
댓글: P_L 2019년 4월 16일
Hi there I have 15 sets of x,y,z data points. I want to compute 105 possible combinations of these points using a computational method. I believe I will want to use a loop although I am not sure how to set one up that discards any repeating combinations.
This is the code I have:
% script to caluclate the correlation dimension of points
% with delta[log N_D (R)] / delta (log R) ( taken from Kagan.Y (2007)
% Earthquake spacial distribution: The correlation dimension.
% where
% D = dimensionality = 3-D
% N = total number of earthquake pairs = n(n-1)/2
% R = distance between points = sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2)
N = 15*(15-1)/2 %the number of pairs I can have
% The Data set (15 points)
x_vals=[-9.33203 -9.92969 -9.40234 -9.47266 -8.83984 -9.50781 -10.0703 -9.08594 -9.50781 -10.0352 -9.12109 -9.05078 -9.26172 -9.82422 -10.3516];
y_vals=[27.8633 27.6172 27.6523 27.5117 27.9336 27.6172 27.3359 27.6172 27.6172 27.2305 27.9336 28.0039 27.793 27.7227 26.7734];
z_vals=[10.0098 8.04297 8.97461 7.98086 9.51289 8.04297 10.1133 10.0305 7.96016 7.98086 9.47148 7.77383 8.76758 9.34727 7.79453];
Any help would be much appreciated!

채택된 답변

KSSV
KSSV 2019년 4월 16일
  댓글 수: 3
KSSV
KSSV 2019년 4월 16일
LEt x,y,z be your data
xi = nchoosek(x,2) ;
P_L
P_L 2019년 4월 16일
Hi KSSV I don't understand, please could you explain more clearly? I need combinations of x,y and z data.
Many thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by