How can I specify maximum and minimum of a parameter inside a loop

1 Ansicht (letzte 30 Tage)
R@SH
R@SH am 17 Okt. 2021
Beantwortet: KSSV am 17 Okt. 2021
Dear All,
I would like to extract both the maximunm and minimum of a parameter which is obtained within a loop. something like below:
for i=1:50
A(i)=f(i);
B(i)=f(A);
C(i)=F(B);
end
How is it possible to specify both the maximum and minimum of C in its various iteratiuoins and also display the corresponding "A" and "B".

Akzeptierte Antwort

KSSV
KSSV am 17 Okt. 2021
minC = 0;
maxC = 0;
for i=1:50
A(i)=f(i);
B(i)=f(A);
C(i)=F(B);
if C > maxC
maxC = C ;
maxA = A ;
maxB = B
end
if C < minC
minC = C ;
minA = A ;
minB = B ;
end
end

Weitere Antworten (0)

Kategorien

Mehr zu Spline Postprocessing finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by