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?

1 次查看(过去 30 天)
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

回答(1 个)

Walter Roberson
Walter Roberson 2018-3-29
>> 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.

类别

Help CenterFile Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by