Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB FUNCTION SCRIPT The power output of a solar cell varies with the voltage

ID: 3715025 • Letter: M

Question

MATLAB FUNCTION SCRIPT

The power output of a solar cell varies with the voltage it supplies and the temperature it operates at. The following model relates the Voltage at which a solar cell produces maximum power (V_mp) to the operating temperature (T) and the open circuit voltage (V_OC), which is characteristic of a particular cell.

The parameters q and k_B are the charge on an electron (q = 1.6022E-19 Coulombs) and the Boltzmann constant (k_B = 1.3806E-23 Joules/Kelvin). Write a function that outputs the Voltage(s) for maximum power output (V_mp) given an input vector of one or more temperatures and the open circuit voltage of the solar cell. The function should accept the following inputs (in order):

1. A vector of one or more operating temperatures (T) in degrees Kelvin.

2. The open circuit voltage (V_OC) in Volts.

3. An initial guess for the numerical solution of V_mp in Volts.

4. A stopping criterion for the numerical solution.

Your function should use fzero along with the input initial guess and stopping criterion to solve for V_mp corresponding to each value in the input vector of temperatures. Your function should have two outputs (in order):

a. A column vector of V_mp values corresponding to the input vector of operating temperatures.

b. A column vector of residual values associated with the numerical solution for each value of V_mp.

qVoc mp kBT

Explanation / Answer

Ln= input('enter Ln value')

Lp= input('enter Lp value')

W= input('enter W value')

n= input('enter n value')

FF= input('enter Form factor value')

Isc=qK( Ln+ Lp+W)

Voc= input('enter Voc value')

eff= input('enter efficiency value')

Io=Isc/(e^(Q*Voc/(n*k*T))-1)

maximum power =Voc*Isc*FF/eff

V(0)=1

I(0)=Io*(e^(q*V/(n*K*T)-1)

V(1)=1

I(1)=Io*(e^(q*V/(n*K*T)-1)

X(0)=V(0)*I(0)

X(1)=V(1)*I(1)

i=0

while(X(i)<maximum power)

i=i+1

if(X(i)<X(i-1))

V(i)=V(i-1)+0.001

else

V(i)=V(i-1)-0.001

end

I(i)=Io*(e^(q*V/(n*K*T)-1)

X(i)=V(i)*I(i)

end