Q_i = S*tau*e_paint*A_pt;
Q_rad = @(T_pt)(e_paint*sigma*A_pt*(T_pt^4 - T_sun^4));
Q_conv = @(T_pt, T_air)((1.68*(T_pt-T_air)^(1/2))*A_pt*(T_pt-T_air));
Q_heat_plate = @(T_pt, T_pt_LAST)((m_p*c_a+m_t*c_c)*(T_pt -T_pt_LAST));
Q_water = @(T_w,T_pt)(h_w*A_inside*(T_pt - T_w));
solver_T_pt = @(T_pt)(Q_rad(T_pt) + Q_conv(T_pt, T_air) + Q_heat_plate(T_pt, T_pt_LAST) + Q_water(T_water_average, T_pt) - Q_i);
T_pt_num = fzero(solver_T_pt, 293); %[K] temperature aluminiumplate and tube
q_heat_air = Q_conv(T_pt_num, T_air); %Determining the energy to the air through convection
T_air_num = (q_heat_air)/(m_air*c_air_p) + T_air; %[K] New Temperature of air
I am using a fzero function here to solve this problem, however in line 3 an error eccors when using ^1/2. When I use ^2 for example the function works fine so the fzero probably goes bad on the root but how do I fix this?

답변 (1개)

madhan ravi
madhan ravi 2020년 6월 4일

0 개 추천

.* .^

댓글 수: 5

Tim Pijnacker
Tim Pijnacker 2020년 6월 4일
편집: Tim Pijnacker 2020년 6월 4일
I have tried this but it did not help, I am working with variables and not with an array so then it shouldn't be a problem right?
madhan ravi
madhan ravi 2020년 6월 4일
편집: madhan ravi 2020년 6월 4일
Did you say what error occurred? Did you define the variables? Did you think others could run the code without providing the datas? fzero(...) expects numeric input and not symbolic.
doc fzero
The variables are defined, I can just no supply the whole code because it would be way to huge.
The error I am getting is
Error in plate_v2 (line 44)
T_pt_num = fzero(solver_T_pt, 293); %[K] temperature aluminiumplate and tube
Steven Lord
Steven Lord 2020년 6월 4일
That doesn't look like the whole error message. Can you show us all the text displayed in red when you run your code? There should be something displayed before the "Error in plate_v2" line.
Tim Pijnacker
Tim Pijnacker 2020년 6월 4일
You are right! I actually missed that bit thanks. Could the problem be that T_pt and T_air are to close at the start which makes it infinitely small, or should this then also be a problem when squaring it?
(For a bit more background on the code, it is a tempertature model for a solar collector. At the start T_pt and T_air are both room temperature and after that they both rise due to radiation of the sun but T_pt rises faster then T_air)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

태그

질문:

2020년 6월 4일

댓글:

2020년 6월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by