When I provide Vpv = 0:0.1:30 the desired 'x' value is not changing,i'm getting an array of a single value... but , if I give a single value of Vpv, i get corresponding 'x' value. Where is the modification needed for getting variable 'x' values?

2 views (last 30 days)
Function file :
function F = pvcurve( Ipv )
global Np Ns Isc q T k Io n
Vpv= 100 ;
% Np = 1 ;
% Ns=72 ;
% Isc =1.82 ;
% q= 1.6e-19 ;
% T=298 ;
% k=1.38e-23 ;
% Io= 1.2987e-4 ;
% n=1.8405 ;
for i=1:length(Vpv)
F(i) = -(Ipv)+ (Np*Isc)- Np*Io*((exp((q*Vpv(i))/(n*k*T*Ns))-1));
end
end
Main file :
clear;clc;close all;
Vpv= 100 ;
Ipv0 = 0;
global Np Ns Isc q T k Io n
Np = 1 ;
Ns=72 ;
Isc =1.82 ;
q= 1.6e-19 ;
T=298 ;
k=1.38e-23 ;
Io= 1.2987e-4 ;
n=1.8405 ;
for i=1:length(Vpv)
x(i) = fsolve(@pvcurve, Ipv0 )
end

Answers (1)

Walter Roberson
Walter Roberson on 29 Mar 2018
>> syms Np Ns Isc q T k Io n Vpv Ipv
>> F = -(Ipv)+ (Np*Isc)- Np*Io*((exp((q*Vpv)/(n*k*T*Ns))-1));
>> solve(F,Ipv)
ans =
Isc*Np - Io*Np*(exp((Vpv*q)/(Ns*T*k*n)) - 1)
So, you do not need fsolve: you can just code your constants and your vector of values for Vpv, and then
x = Isc*Np - Io*Np*(exp((Vpv*q)/(Ns*T*k*n)) - 1);
all solved at one time.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!