Solving Equations with inputs from an Excel file

3 views (last 30 days)
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);

Accepted Answer

Alex Mcaulley
Alex Mcaulley on 23 Jul 2019
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 Comments
rammah nagi
rammah nagi on 23 Jul 2019
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 on 24 Jul 2019
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)'}));

Sign in to comment.

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!