How to find the max value of a curve on a graph

10 views (last 30 days)
Will Jeter
Will Jeter on 12 Nov 2020
Answered: KSSV on 12 Nov 2020
I'm trying to find the max value of my G(T) curve(the parabolic one). Not sure how to het the value and make it show up as a marker on the graph
T = [310:1:450];
v = 1;
V = 10;
dHrxn = -80000;
UA = 3600;
kf0 = 1;
kc0 = 100;
T0 = 400;
ER = 20000;
CpA = 40;
kf = exp(-20000*(1./T-1/400));
kc = 100*exp((80000/1.987)*(1./T-1/400));
x = 1./(v./(V.*kf)+1+(1./kc));
R = 400*(T-310);
R1 = 400*(T-256);
R2 = 400*(T-233.5);
R3 = 400*(T-218.2);
R4 = 400*(T-391);
R5 = 400*(T-328);
R6 = 400*(T-346);
R7 = 400*(T-353.2);
G = x*-dHrxn;
figure
hold all
plot(T,R,T,G,T,R1,T,R2,T,R3,T,R4,T,R5,T,R6,T,R7)
legend('R(T)','G(T)','Ta=250K','Ta=225K','Ta=208K','Ta=400K','Ta=330K','Ta=350K','Ta=358K','Location','NorthWest')
axis([310 450 0 10*10^4])
xlabel('Temperature (K)')
ylabel('G(T) and R(T) (cal/mol)')
title('G(T) and R(T) vs. T')

Answers (1)

KSSV
KSSV on 12 Nov 2020
If (x,y) are the data points.
[val,idx] = max(y) ;
plot(x,y)
hold on
plot(x(idx),y(idx),'*r')

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!