Info
此问题已关闭。 请重新打开它进行编辑或回答。
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)
    4 次查看(过去 30 天)
  
       显示 更早的评论
    
function [CF]= Coherence_Factor(xm,N);
CF = ((abs (sum(xm))).^2) / (N* sum(abs(xm.^2)))
end
0 个评论
回答(1 个)
  VBBV
      
      
 2022-12-31
        
      编辑:VBBV
      
      
 2022-12-31
  
      xm = rand(5,10);
N = 10;
[CF]= Coherence_Factor(xm,N)
function [CF]= Coherence_Factor(xm,N);
CF = ((abs (sum(xm))).^2) ./ (N* sum(abs(xm.^2)));
end
2 个评论
  VBBV
      
      
 2022-12-31
				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
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


