Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Hello, how can I do a (loop) for this equation to find more than one value of the CF ? Specifically, I mean more than one value for (xm)

2 vues (au cours des 30 derniers jours)
hisham mohammed
hisham mohammed le 31 Déc 2022
Clôturé : Voss le 1 Jan 2023
function [CF]= Coherence_Factor(xm,N);
CF = ((abs (sum(xm))).^2) / (N* sum(abs(xm.^2)))
end

Réponses (1)

VBBV
VBBV le 31 Déc 2022
Modifié(e) : VBBV le 31 Déc 2022
xm = rand(5,10);
N = 10;
[CF]= Coherence_Factor(xm,N)
CF = 1×10
0.4110 0.3906 0.3169 0.3752 0.2497 0.3349 0.3822 0.4066 0.4420 0.3975
function [CF]= Coherence_Factor(xm,N);
CF = ((abs (sum(xm))).^2) ./ (N* sum(abs(xm.^2)));
end
  2 commentaires
VBBV
VBBV le 31 Déc 2022
for loop is not needed to find more than one value of CF or xm. However, you can still get such result with for loop also as
xm = randi([0 10],1,10);
N = 10;
for k = 1:length(xm)
CF(k)= Coherence_Factor(xm(k),N);
end
plot(CF)
function [CF]= Coherence_Factor(xm,N);
CF = ((abs (sum(xm))).^2) / (N* sum(abs(xm.^2)));
end

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by