Why am I getting the error "Too many output arguments"?
Mostra commenti meno recenti
%initialise paramteres
A = 1.7;
k = 1.380658*(10^-23);
q = 1.6 * (10^-19);
Eg = 1.1;
Ior = 19.9693*(10^-6);
Iscr = 3.3;
ki = 1.7 * (10^-3);
ns = 40;
np = 2;
Rs = 5*(10^-5);
Rp = 5*(10^5);
Tr = 301.18;
Ta = 25;
%array error = 1;
amb = [25 40 60];
irr = [0.3 0.5 1];
%Evaluate
hold on
for i=1:3
Ipv = [];
Vpv = [];
Ppv = [];
G= irr(i);
Tc = Ta + (0.2*G) + 273.18;
Isc = (Iscr + ki*(Tc-Tr))*G;
Is = Ior * ((Tc/Tr)^3) * exp(q*Eg*(1/Tr-1/Tc)/(k*A));
I = Isc;
V = 0;
while I>0
while error>0.0001
f1= I-(np*Isc)+(np*Is)*(exp(q*((V/ns)+(I*Rs/np))/(A*k*Tc))-1)+(((V*np/ns)+(I*Rs))/(Rp));
df1= 1+(Rs/Rp)+((q*Is*Rs)/(A*k*Tc))*(exp(q*((V/ns)+(I*Rs/np))/(A*k*Tc)));
I= I-(f1/df1);
error=abs(f1/df1);
end
Ipv= [Ipv I];
Vpv = [Vpv V];
Ppv= [Ppv I*V];
V = V+0.1;
error = 1;
end
plot(Vpv, Ipv);
% plot(Vpv, Ppv);
end
Risposta accettata
Più risposte (2)
You don't initialize "error" in your code by giving it a value before you use it in the while loop.
That's why MATLAB assumes error to be the built-in "error" command:
Walter Roberson
il 3 Mar 2024
You do not initialize error before you use it.
error happens to be the name of an important Mathworks function -- a function that is not permitted to return a value and so cannot exist in a form
while error>0.0001
Best would be if you used a different variable name (and made sure to initialize it). Compromise would be if you assigned to error before you use it.
Categorie
Scopri di più su Linear Predictive Coding in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
