How do I see all the answers of the iteration?
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm trying to see the difference in output for varying Tj values.
I get the final output, but I would like to see all of the outputs corresponding to the different Tj values.
How do I got about this?
댓글 수: 0
채택된 답변
Raghava S N
2023년 6월 19일
Move the constants out of the loop. Then, see what variables depend on Tj and put them in the loop. Assuming you want to find the value of renergyfromreactor for each value of Tj, put the evaluation statement as well in the loop. Declare the result as an array of zeros. Keep a loop counter, say k to make entries into the result array. Each time in the loop, evaluate for that Tj and write into the output array. Hope this helps!
function [renergyfrom reactor, list_of_Tjs] = Radiant_Energy_From_Reactor_Surface(Ai, Ei, Viewfactorij, Ti, Tj);
Ri = 0.22;
Rj = 0.1;
H = 0.197;
Ai = pi*Ri^2;
Aj = pi*Rj^2;
Ti = 900;
Tj = 600;
Zz = Ti^4;
Ei = 0.8;
sigma = 5.6704e-8;
Viewfactorij = 0.1088;
renergyfromreactor = zeros(1, length(10:10:70));
list_of_Tjs = zeros(1, length(10:10:70));
k = 1;
for i=10:10:70
Yy = Tj^4;
ZY = Zz-Yy;
renergyfromreactor(k) = sigma*Ai*Ei*Viewfactorij*ZY;
list_of_Tjs(k) = Tj
Tj = Tj + i;
k=k+1;
end
end
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!