Effacer les filtres
Effacer les filtres

Solving Equations with inputs from an Excel file

2 vues (au cours des 30 derniers jours)
rammah nagi
rammah nagi le 23 Juil 2019
Commenté : Alex Mcaulley le 24 Juil 2019
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 commentaires
Alex Mcaulley
Alex Mcaulley le 23 Juil 2019
Can you upload your data?
rammah nagi
rammah nagi le 23 Juil 2019
Yes, I have attached the excel file to this

Connectez-vous pour commenter.

Réponse acceptée

Alex Mcaulley
Alex Mcaulley le 23 Juil 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 commentaires
rammah nagi
rammah nagi le 23 Juil 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 le 24 Juil 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)'}));

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Tags

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by