What is wrong with this code?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am getting an error message "Array indices must be positive integers or logical values.
Error in take_home_exam_problem2 (line 23)
delT2=delT1*exp(-UA((1/Ch)+(1/Cc)))"
I'm not even sure what an array indices is in this problem, can anyone help me with this?
My code:
start
%user section
%assign our variables
Th1=575;% K inlet hot stream temperature
Tc1=320;% K inlet cold stream temperature
UA=25000;% kJ/(K-hr) heat transfer coefficient
Cph=2.0;% J/(kg-K) heat capacity of hot stream
Cpc=1.1;% J/(kg-K) heat capacity of cold stream
mh=2500;% kg/hr hot stream
mc=800;% kg/hr cold stream
%Main program
%do matlab calculations
delT1=Th1-Tc1
Ch=mh*Cph
Cc=mc*Cpc
delT2=delT1*exp(-UA((1/Ch)+(1/Cc)))
q=UA*((delT2-delT1)/log(delT2/delT1))
end
0 Kommentare
Antworten (1)
Megumi Fukuda
am 1 Mär. 2021
I assume this is what you meant?
delT2=delT1*exp(-UA*((1/Ch)+(1/Cc)))
See the * between -UA and (.
-UA((1/Ch)+(1/Cc)) means (1/Ch)+(1/Cc)th element of -UA.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!