How can I connect the maximum points of several
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
darova
2021-3-13
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 个评论
darova
2021-3-13
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])
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!