Help in fzero function
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Manal KOUIHI
el 16 de Feb. de 2021
Comentada: Walter Roberson
el 18 de Feb. de 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 comentarios
Walter Roberson
el 16 de Feb. de 2021
Not enough information to go on. We need your code to test with.
Respuesta aceptada
Walter Roberson
el 16 de Feb. de 2021
You should not have named your function fzero.m -- doing that interferes with calling the MATLAB fzero function.
2 comentarios
Walter Roberson
el 18 de Feb. de 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)
Más respuestas (1)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

