Filter löschen
Filter löschen

Efficient way to implement a Summation within an Integral

2 Ansichten (letzte 30 Tage)
Saravanan Nagesh
Saravanan Nagesh am 5 Sep. 2021
Bearbeitet: Saravanan Nagesh am 5 Sep. 2021
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.

Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by