Help in fzero function
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Manal KOUIHI
il 16 Feb 2021
Commentato: Walter Roberson
il 18 Feb 2021
Hi
I want to use the function fzero for modeling PV Cell, but i have a problem about the line (I=fzero(fun,I0))
they display me : Error in fzero
2 Commenti
Risposta accettata
Walter Roberson
il 16 Feb 2021
You should not have named your function fzero.m -- doing that interferes with calling the MATLAB fzero function.
2 Commenti
Walter Roberson
il 18 Feb 2021
Your code never assigns to V, but uses it in fun() and also uses it in plot()
Note that fzero() can only output a scalar in any one call, so your I would be a scalar if the all works. Also, the function you pass to fzero() must return a scalar. Your function uses all of V in a way that the output is going to be the same size as V, so your V would have to be a scalar too.
Then you get down to plot(V,I) but both of them are scalars. When you plot() a scalar, no line will be generated, and if you do not specify a marker, no marker will be drawn either.
My guess is that you want something like:
V = linspace(-5, 10);
funV = @(I,v)(I-(Ipv- Io*(exp((V+(I*Rs))/(Vt*a))-1))-((v+(Rs*I)/Rp)));
I = arrayfun(@(v) fzero(@(I) funV(I,v), I0), V);
plot(V, I)
Più risposte (1)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

