Error using fzero in a loop
6 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Direct Search in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!