Solving Equations with inputs from an Excel file

3 ビュー (過去 30 日間)
rammah nagi
rammah nagi 2019 年 7 月 23 日
コメント済み: Alex Mcaulley 2019 年 7 月 24 日
Hi, I am modelling a solar panel and I am struggling to get a solution for the Tpv shown in the code. When I use a single value for Ta there are no problems in finding an exact solution. However when I get the Ta to be read from the excel sheet (column 8, 24 rows) it returns me with no solutions (In the workspace Tpv is defined as "0x1 sym"). I have pasted my model below, any help would be greatly appreciated.
Hi, I am modelling a solar panel and I am struggling to get a solution for the Tpv shown in the code. When I use a single value for Ta there are no problems in finding an exact solution. However when I get the Ta to be read from the excel sheet (column 8, 24 rows) it returns me with no solutions (In the workspace Tpv is defined as "0x1 sym"). I have pasted my model below, any help would be greatly appreciated.
%% Energy balance Top layer
fileName1 = '1Day.xlsx';
numData1 = xlsread(fileName1);
Ta = numData1(:,8);
EtaG = 0.88; %emissivity of glass
Sigma = 5.67*10^-8; %stefan boltsman constant
Tsky = 0.0552.*Ta.^(1.5);
Tg = Ta + 10;
qsky = EtaG*Sigma.*(Tg.^4-Tsky.^4); %heat flux loss between sky and glass
Vw= numData1(:,12);
hwind = 4.5+2.9.*Vw;
qwind = hwind.*(Tg-Ta);
kair = 0.025;
eag = 0.005;
Etapv = 0.9;
syms Tpv
eqn1 = qsky + qwind == (Sigma .* (Tpv.^4 - Tg.^4)) / (1 / Etapv + 1/EtaG - 1) + (kair / eag) .* (Tpv - Tg);
Tpv= solve(eqn1,Tpv);
  3 件のコメント
Alex Mcaulley
Alex Mcaulley 2019 年 7 月 23 日
Can you upload your data?
rammah nagi
rammah nagi 2019 年 7 月 23 日
Yes, I have attached the excel file to this

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

採用された回答

Alex Mcaulley
Alex Mcaulley 2019 年 7 月 23 日
I suspect you have an overdetermined system (1 variable and 24 equations). Probably you want this:
%% Energy balance Top layer
fileName1 = '1Day.xlsx';
numData1 = xlsread(fileName1);
syms Tpv Ta Vw
% Ta = numData1(:,8);
EtaG = 0.88; %emissivity of glass
Sigma = 5.67*10^-8; %stefan boltsman constant
Tsky = 0.0552.*Ta.^(1.5);
Tg = Ta + 10;
qsky = EtaG*Sigma.*(Tg.^4-Tsky.^4); %heat flux loss between sky and glass
% Vw = numData1(:,12);
hwind = 4.5+2.9.*Vw;
qwind = hwind.*(Tg-Ta);
kair = 0.025;
eag = 0.005;
Etapv = 0.9;
eqn1 = qsky + qwind == (Sigma .* (Tpv.^4 - Tg.^4)) / (1 / Etapv + 1/EtaG - 1) + (kair / eag) .* (Tpv - Tg);
Tpv = solve(eqn1,Tpv);
res = double(subs(Tpv,{Ta,Vw},{numData1(:,8)',numData1(:,12)'})) %Where each column of res contains the solutions for each pair of values (Ta,Vw)
  3 件のコメント
rammah nagi
rammah nagi 2019 年 7 月 23 日
Say I wanted to use the values obtained from Tpv in another equation
qrpv= (Sigma * (res.^4 - Tg.^4)) / (1 / Etapv + 1/EtaG - 1);
qrpv1 = double(subs(qrpv,{Ta,Vw},{numData1(:,8)',numData1(:,12)'}));
Would this be the way to go about it?
Alex Mcaulley
Alex Mcaulley 2019 年 7 月 24 日
Well, the correct way to do this is doing the substitution at the end (keeping the symbolic variables):
qrpv= (Sigma * (Tpv.^4 - Tg.^4)) / (1 / Etapv + 1/EtaG - 1);
qrpv1 = double(subs(qrpv,{Ta,Vw},{numData1(:,8)',numData1(:,12)'}));

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by