Solving Equations with inputs from an Excel file

3 次查看(过去 30 天)
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);

采纳的回答

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 CenterFile Exchange 中查找有关 Time Series Objects 的更多信息

标签

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by