Efficient way to implement a Summation within an Integral
3 views (last 30 days)
Show older comments
Hi i'm trying to implement the following equation efficiently, where
is the normalized column vector
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/730069/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/730074/image.png)
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.
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!