How I solve a nonlinear equation with matlab function block?
Ältere Kommentare anzeigen

Here is my blocks and 'Generator' matlab function block contents is
function StrongSolution = Generator(HotWater,WeakSolution, CoolingCapacity)
P = 4.82 % [kPa], Absolute Pressure
Cp = 4.2 % kJ/kgK
T_in = HotWater(1) % Celious
T_out = HotWater(2) % Celious
m_w = HotWater(3) % kg/s
T_w = WeakSolution(1) % Celious
x_w = WeakSolution(2)/100 % Nondimension
m_w = WeakSolution(3) * CoolingCapacity % kg/s
h_w = WeakSolution(4) % kJ/kg
WasteHeat = m_w*Cp*(T_in - T_out) % kJ
Tacc = 88
UA_G = 16.6*CoolingCapacity/(0.0986*exp(0.0254*Tacc))
T_lmG = WasteHeat/UA_G
fun = @(T_s) T_lmG - ((T_out-T_w)-(T_in-T_s))/log((T_out-T_w)/(T_in-T_s))
T_s = fzero(fun,[55 100])
StrongSolution = T_s
end
And I upload my problem.
I wanted to know 'T_s'. So I used 'fzero' function in a Matlab function block.
But the error was occured.

How can I solve the problem?
1 Kommentar
MinWoo Nam
am 4 Sep. 2020
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Simulink Coder finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!