MATLAB: How to connect the maximum points of several

connect maximum pointsmaximum pointsseveral graphs

Hello friends, I want to connect the maximum points of several graphs with a curved line in one figure. I can calculate the coordinates of maximum points then connect them with a line, But I want a code that Matlab itself recognizes the maximum points and connects them. Thanks for your attention

Best Answer

THe short version
clear
clc
t=263:1:383;
rr = 1:5;
for r = [ rr/1000 rr/100 rr/10 rr ]
[T, R]=meshgrid(t,r);
k1=exp(17.34-(48900./(8.314*T)));
k2=exp(42.02-(124200./(8.314*T)));
XA=(k1-R)./(k1+k2);
[XA_max, index] = max(XA);
T_max = T(index);
plot(T, XA, T_max, XA_max, 'ro')
axis([263,383,0,1])
grid on
hold on
end
hold off