Efficient way to implement a Summation within an Integral

Hi i'm trying to implement the following equation efficiently, where is the normalized column vector
The following is my implementation
% function for normalize column vector
nc = @(col) col./norm(col);
% implementation of equation in picture
for m=1:size(Cs,2)
ftemp = [];
for l = 1:size(Cs,2)
if l ~= m % calculation of integral for every l neq to m
fun1 = @(k)(((nc(Cs(:,m)))-(nc(Cs(:,l)).*exp(1j*k)))./(norm(((nc(Cs(:,m)))-(nc(Cs(:,l)).*exp(1j*k))),v)));
fint1 = integral(fun1,0,2*pi,'ArrayValued',true);
ftemp = [ftemp,fint1];
end
end
% cal the sum for every mth value
F(:,m) = sum(ftemp,2);
end
I am a bit worried if the summation under the condition is implemented right, is there a way to cross verify and also a better and more efficient way to do the sum inside integrals ???
Please advice.

Answers (0)

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Asked:

on 5 Sep 2021

Edited:

on 5 Sep 2021

Community Treasure Hunt

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

Start Hunting!