How can I connect the maximum points of several
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Xerxes Achaemenid
am 13 Mär. 2021
Kommentiert: Xerxes Achaemenid
am 13 Mär. 2021
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
2 Kommentare
Akzeptierte Antwort
darova
am 13 Mär. 2021
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
3 Kommentare
darova
am 13 Mär. 2021
Another interpretation
clear
clc
cla
t = linspace(263,383,30);
rr = 1:5;
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);
[~, index] = max(XA,[],2);
ind = sub2ind(size(XA),1:size(XA,1),index(:)');
plot(T(ind), XA(ind), 'r-o')
line(T',XA')
text(T(ind), XA(ind),num2str(XA(ind)'))
ylim([0 1])
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Entering Commands 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!