# Multiple Equations in Matlab Solver

57 ビュー (過去 30 日間)
Ieuan Price-davies 2021 年 3 月 22 日
コメント済み: Ieuan Price Davies 2021 年 3 月 25 日
Hi everyone,
I'm trying to calculate heat change through a solar panel. In order to do this I need 4 equations that I then use an energy balance to solve.
The 4 equations are:
%Heat Flux between glass & sky
Qsky = Eg .* StefanBoltzmann .*(TEa^4 - TEsky^4);
%Heat Flux loss due to forced wind convection
Qwind = Hwind*(TEg - TEa);
%Heat Flux to PV due to radiation
Qrpv = (StefanBoltzmann*(TEpv^4 - TEg^4))/(1/Epv + 1/(Eg-1));
%Conductive tranfer to PV layer
Qpv = Keva*(TEpv - TEg);
The unknown here is TEpv, the code I'm currently using to find this is:
syms Qsky Qwind Qrpv Qpv
%Those 4 equations in here
eqn = Qsky + Qwind == Qrpv + Qpv + J*Ag
S = solve(eqn,TEpv)
When I use this however no value is sent to S.
The variables Eg, StefanBoltzmann, etc. are defined earlier in the program, they are constants that will be used for more steps along the way, do I have to define them in the syms line? If anone knows how to fix this it would be greatly appreciated.
Many Thanks,
Ieuan

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

### 回答 (1 件)

John D'Errico 2021 年 3 月 22 日
No. You have ONE equation. It just happens that you defined it in 4 pieces, then you added them all up.
If you defined them as constants earlier, then you do NOT want to define those other variables in the syms call. If you did that, it would overwrite the values for those constants. Similarly, putting this line in your code,
syms Qsky Qwind Qrpv Qpv
again overwrites the variables you just created. That just undid all the work you did in the previous lines. So DELETE that use of syms. If you don't believe me, consider this example:
X = 3
X = 3
So at this point, X is defined. It has the value 3. MATLAB tells us that.
syms X
X
X =
X
Here X no longer has the value 3. It is just a simple symbolic parametre, with comepletely unknown value.
Anyway, when you use that call to solve, what does it show? (Nothing is sent.) MATLAB does not use mail in any form. Why do you think nothing happens?
If all of the other parameters are known, then you have what is merely a 4th degree polynomial in the unknown, so it should be solvable.
##### 3 件のコメント表示非表示 2 件の古いコメント
Ieuan Price Davies 2021 年 3 月 25 日
Thanks, I have defined thos values seperately as there are many constants in use in this model. I appreciate your help with the solver though - really helped cheers!

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

### Community Treasure Hunt

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

Start Hunting!

Translated by