Filter löschen
Filter löschen

how to find when the function reaches its maximum value and calculate a value at a certain point

3 Ansichten (letzte 30 Tage)
i have this function:
function ydot= fossil_fuels(t,y)
p=y(1); sigmas=y(2); sigmad=y(3); alphas=y(4); alphad=y(5);
r=[0.0 0.0 1.0 4.0 5.0 8.0 10.0 10.5 10.0 8.0 3.5 2.0 0.0 0.0];
yr=[1000 1850 1950 1980 2000 2050 2080 2100 2120 2150 2225 2300 2500 5000];
f=pchip(yr,r);
d = 8.65;
mu1 = 4.95 * 10^2;
mu2 = 4.95 * 10^(-2);
vs = 0.12;
vd = 1.23;
w = 10^(-3);
k1 = 2.19 * 10^(-4);
k2 = 6.12 * 10^(-5);
k3 = 0.997148;
k4 = 6.79 * 10^(-2);
hs = (sigmas-(sigmas^2 - k3*alphas*(2*y(2) - alphas))^0.5)/k3;
cs = (alphas - hs)/2;
ps = k4*(hs^2 / cs);
dpdt = (ps - p)/d + ppval(f,t) /mu1;
dsigmas_dt = (1/vs)*((sigmad - sigmas)*w - k1 - ((ps - p)/d)*mu2);
dsigmad_dt = (1/vd)*(k1 - (sigmad - sigmas)*w);
dalphas_dt = (1/vs)*((alphad - alphas)*w - k2);
dalphad_dt = (1/vd)*(k2 - (alphad - alphas)*w);
ydot = [dpdt; dsigmas_dt; dsigmad_dt; dalphas_dt; dalphad_dt];
end
Now i was asked to find when does p reach its maximum, how ever i can only find the maximum value but don't really knowing how to find when, can somebody help me.
and also if possiple does anybody know how to calculate p only from the function at a certain t
thanks
  1 Kommentar
Walter Roberson
Walter Roberson am 30 Mai 2019
p cannot increase if its derivative goes negative (not unless there is some way for the derivative to go positive again).
You could consider using an event function.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Transportation Engineering 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!

Translated by