필터 지우기
필터 지우기

Solving Equations with inputs from an Excel file

조회 수: 2 (최근 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 CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by