Plotting the theoretical maximum possible efficiency of a heat engine
조회 수: 2(최근 30일)
I'm trying to create a temperature vs. efficiency plot using the equation n=1-(Tl/Th) for 3 different Tl values.
Matlab keeps telling me "index exceeds the number of array elements" and Th only eqauls 299.1 instead of the whole range it is supposed to run through. Can anybody tell me what I'm doing wrong here?
David Goodmanson 2022년 9월 6일
편집: David Goodmanson 2022년 9월 6일
It's possible to fix up the for loop, but easier and much more in the spirit of Matlab to do this with vectors.
TME = 1 - (Tl1./Th);
TME2 = 1 - (Tl2./Th);
TME3 = 1 - (Tl3./Th);
Here the use of ./ means that Th is divided into the numerator on an element-by-element basis, so for e.g. TME you get a vector the same length as Th.