MATLAB: PV module I-V curve Rs, Rsh, error,

i-v curveiscmpptplotpv arraypv cellpv modulersrshsolar cellsolar cell parametersvoc

Hi, my problem is when ı try to start these algorithm it's working. But when i try to change Rs value like different than 0 it's giving error.
"Error using plot. Non-numeric data is not supported in 'Line'"
I need to change value of Rs(manual), and I need to get I-V graph…
Thanks for helping
here is my code;
syms Vt Rp Rpmin Io Ipv V I Rp1 Pmax P Rs
Pmax=200.143;
Imp=7.61;
Vmp=26.3;
Iscn=8.21;
Vocn=32.9;
Ns=54;
q=1.60217646*(10^(-19));
K=1.3806503*(10^(-23));
ki=0.0032;
kv=-0.1230;
Tnom=298.15;
Gnom=1000;
a=1.3;
Vt=K*Tnom*Ns/q;
% for T G calculate Io , for Rs=0 Rpm,n
G=1000;
T=298.15;
Io=(Iscn+ki*(T-Tnom))/(exp((Vocn+kv*(T-Tnom))/(a*Vt))-1)
Rpmin= (Vmp/(Iscn-Imp))-((Vocn-Vmp)/Imp)
Rs=0;
Rp=Rpmin;
Ipvn= ((Rp+Rs)/Rp)*Iscn
Ipv=(Ipvn+ki*(T-Tnom))*(G/Gnom)
Rp1= (Vmp*(Vmp+Imp*Rs))/(Vmp*Ipv-Vmp*Io*exp(((Vmp+Imp*Rs)*q)/(Ns*a*K*T))+Vmp*Io-Pmax)
V=0:0.1:32.9;
I=Ipv-Io*exp((V+I*Rs)/(a*Vt))-((V+I*Rs)/Rp1)
plot(V,I)

Best Answer

Hi Emircan
your script doesn't work for Rs>0 because as soon as Rs is not null, you are attempting to pass a vector and and an implicit function to command plot, where plot expects just 2 vectors, let me explain:
You may just plot with V alone
plot(V)
It works with any value of Rs, but then the X axis labels have to be re-tagged accordingly.
The problem lays in the line previous to plot
I=Ipv-Io*exp((V+I*Rs)/(a*Vt))-((V+I*Rs)/Rp1)
Note that you have I on both sides of the equal.
The only way for MATLAB to accept plot(V,I) is to either first solve that equation and pass the solved equation, or correct any possible error like perhaps the equation that you really need is
I=Ipv-Io*exp((V+Io*Rs)/(a*Vt))-((V+Io*Rs)/Rp1)
or
I=Ipv-Io*exp((V+Ic*Rs)/(a*Vt))-((V+Ic*Rs)/Rp1)
Where Ic may be a collector current that requires additional equations prior attempting to solve I and then plot.
.
So omitting I in plot or correcting the I equation you should be able to plot.
.
Yet, for further assistance, would it be possible for you to show the circuit diagram?
is it a transistor bias that you are modelling? or a diode?
if you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance
John BG