# I am writing a code to solve a set of nonlinear equations using fsolve, but i keep getting this message "no solution found" and also " fsolve stopped because the last step was ineffective. the vector of function value is not near zero "

1 ビュー (過去 30 日間)
george mobol 2016 年 7 月 1 日

This is the function file below.
function E=trial2(s)
u = 10; % wind speed
Ta=286;% ambient temp in kelvin
hwind = 2.3 + u; %(convective heat transfer coeff)
Tg=15; % glass temp
Rpvg=0.0014286; % resistance of glass-pv
Rbpv=1.93*10^(-3);% resistance of base pv
alpha_g=1; % absoprptivity of glass
epsilon_g=0.84;% emissivity of glass
sigma=5.67*(10^8);% boltzman's constant
Tpv=s(1);
Tb=s(2);
E(2)=G*alpha_g+((1/Rpvg)*(Tg-Tpv))+((1/Rbpv)*(Tb-Tpv));% pv thermal balance eqn
end
and the execution script below
sg = [50;50]; % iterating with random temperature
s = fsolve(@trial2,sg) % using fsolve to get Tpv and Tb

サインインしてコメントする。

### 採用された回答

Walter Roberson 2016 年 7 月 1 日
If you have the Symbolic Toolkit, then you can use
s = [sym('S1'), sym('S2')];
E = trial2(s);
s1 = solve(E(1), s(1));
s2 = solve(subs(E(2),s(1),s1),s(2));
double(s1), double(s2)
The outputs are approximately -23786403074636.8 and -55921190932736.1
Considering the 50 and 50 you used as starting values, I suspect you are not expecting values that large and negative, but these are the solutions given those equations.

サインインしてコメントする。

### その他の回答 (1 件)

george mobol 2016 年 7 月 21 日
Thank you for your answers using the symbols kit. I am trying to solve a similar equation using it but keep getting errors. This is the function file below:
function Eq = trial3(s)
Tg=s(1);
Tpv=s(2);
Tb=s(3);
Teva=s(4);
Eq(1)=8+(3.81*10^(-10)*((276.84^4)-(Tg)^4))+0.1424*(293-Tg)+4.8*(Tpv-Tg);
Eq(2)=-4740.76*(Tpv)+4736*(Tb)-10.733+Tg*(4.8);
Eq(3)=4736*(Tpv+Tb)+1.71;
Eq(4)=4736*(Tpv)-5787.25*(Tb)+1051.25*(Teva);
end
And the execution file as shown.
s = [sym('S1'), sym('S2'), sym('S3'), sym('S4')];
Eq = trial3(s);
s1 = solve(Eq(1), s(1),s(2));
s2 = solve(Eq(2), s(2),s(3));
s3 = solve(Eq(3), s(2),s(3));
s4 = solve(Eq(4), s(2),s(3), s(4));
double(s1), double(s2),double(s3),double(s4)
Thank you
##### 1 件のコメント表示 なし非表示 なし
Walter Roberson 2016 年 7 月 21 日

you cannot solve() one equation for two variables. Also, after you solve the first equation for the first variable you nee to substitute that value into the second equation and solve the result for the second variable, then take the third equation and substitute the first variable's value and then substitute the second variable's value, and then solve the result for the third variable, and so on. Or you could just ask to solve the four equations simultaneously,
solve(Eq)
Note: the solution involves a 4th order polynomial, so there will be 4 sets of solutions.

サインインしてコメントする。

### カテゴリ

Find more on Systems of Nonlinear Equations in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!