Error using fzero in a loop
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm trying to solve a transcendental equation for "i", for all values in my "v" array. I'm getting an error when using fzero in a loop:
Operands to the || and && operators must be convertible to logical scalar values.
Error in fzero (line 327)
elseif ~isfinite(fx) || ~isreal(fx)
Error in RealisticDiodeModel (line 15)
i_arr(index) = fzero(fun, v(index));
Here's my code
for index = 1:n
disp(index);
fun = @(i)IO.*(exp((v + i.*Rser)./(kToq.*eta)) - 1) + (v./Rsh) + i.*(1 + (Rser./Rsh)) - IL;
i_arr(index) = fzero(fun, v(index));
end
Where "n" is the size of my "v" array, and "Rser", "kToq", "eta", "Rsh", "IO", and "IL" are predefined constants. Thanks in advance!
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Direct Search 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!