How do I see all the answers of the iteration?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Eleanor McCabe
am 19 Jun. 2023
Kommentiert: Eleanor McCabe
am 19 Jun. 2023
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 Kommentare
Akzeptierte Antwort
Raghava S N
am 19 Jun. 2023
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements 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!