How to solve 3 non-linear equations with 3 unknowns?

13 views (last 30 days)
This is my code with solve,
G= 1000;
T=298;
Iscr = 9.71; %short citrcuit current
Vocr = 6; %Open circuit voltage
Im = 9.4; %MPP current
Vm = 5.5; %MPP coltage
K_Isc = 0.0005;
Vth = 0.8629*10^(-4)*T;
Iph= (G/1000) * Iscr* (1-(K_Isc)* (T-298 ));
n = 1;
%Io =x
%Rs = y
%Rsh = z
syms x y z
u = -Iscr + Iph - (x * ((exp((Iscr*y)/(n*Vth)))-1)) - ((Iscr*y)/z)==0;
v = Iph - (x * ((exp((Vocr)/(n*Vth)))-1)) - ((Vocr)/z)==0;
w = -Im + Iph - (x * ((exp((Vm + Im*y)/(n*Vth)))-1)) - ((Vm + (Im*y))/z)==0;
x0 = [10^-8,0.2,2500];
d = solve([u,v,w],[x,y,z],x0);
But I got this error:
>> fsolve18_2
Error using sym.getEqnsVars>checkVariables (line 87)
Second argument must be a vector of symbolic variables.
Error in sym.getEqnsVars (line 54)
checkVariables(vars);
Error in solve>getEqns (line 429)
[eqns, vars] = sym.getEqnsVars(argv{:});
Error in solve (line 226)
[eqns,vars,options] = getEqns(varargin{:});
Error in solve18_2 (line 24)
d = solve([u,v,w],[x,y,z],x0);

Answers (2)

Jyotsna Talluri
Jyotsna Talluri on 24 Feb 2020
Edited: Jyotsna Talluri on 24 Feb 2020
We have to specify the equations to solve as the first input argument and variables for which the equation has to be solved as the second input argument to the solve function.There should not be any third argument .Moreover the third argument x0 which you specified is not being used anywhere.
d = solve([u,v,w],[x,y,z]);
d gives the values of x,y,z for which equations u,v,w are satisfied
Refer to the below link for more details

Alex Sha
Alex Sha on 26 Feb 2020
One of numerical solution looks like:
x: 4.49127153145489E-101
y: 0.0437692354838294
z: 867273686630772

Categories

Find more on MATLAB in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!