I need to find the answer for the following error and code

3 vues (au cours des 30 derniers jours)
Prabhath Manuranga
Prabhath Manuranga le 30 Avr 2024
sum1 = zeros(172,1);
sum2 = 0;
for i = 1:length(data2) % Iterate up to the length of H_BM or g_mean
sum1(i) = P1(i)*(g_p(i)+((g_mean(i).*H_BM(i))*(10)^(-5)));
sum2 = sum2 + P1(i);
%fprintf('Iteration %d: sum1 = %.6f\n', i, sum1(i)); % Print iteration output of sum1
end
xx = sum1;
total = sum(xx)
ssum = sum1.*H_BM;
std_ssum = std(ssum,1);
std_ssum
there is a error when taking the total. "Array indices must be positive integers or logical values." please help me to solve this problem.
  4 commentaires
Voss
Voss le 30 Avr 2024
clear sum std
Prabhath Manuranga
Prabhath Manuranga le 30 Avr 2024
Thank you.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by