Double Summation For two point correlation

1 次查看(过去 30 天)
I have to use the double summation function (attached below) where the phi function is the distance formula in three dimensional space. I have the function I need, but I am not sure how to program it into a double summation on MATLAB.
  1 个评论
Alexandra Harkai
Alexandra Harkai 2017-3-3
What have you tried so far? What are D and R? What arguments does your phi function take?

请先登录,再进行评论。

回答(1 个)

Darshan Ramakant Bhat
I think the simpler way is to do using two for loops.
d_sum=0;
for i=1:length(D)
x=D(i);
for j=1:length(R)
y=R(j);
d_sum=d_sum+fi_fun(x,y);
end
end
Additionally you can try to vectorize the process. Following link may help you
Regards,
Darshan Bhat

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by