how can I find the maximum value of a parameter running within a loop

2 次查看(过去 30 天)
Dear All,
I want to extract the maximum of a parameter in aloop through its various ieterations, something like below:
for i=1:100
A=f(i)
B=f(A,i)
C=f(B,i)
end
How can I find the maximum of C and also display corresponding A and B?
I would appreciate your response in advance.

采纳的回答

KSSV
KSSV 2021-10-16
maxC = 0 ;
for i=1:100
A=f(i) ;
B=f(A,i) ;
C=f(B,i) ;
if C > maxC
maxC = C ;
Amax = A ;
Bmax = B ;
end
end
[maxC Amax Bmax]

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by