Borrar filtros
Borrar filtros

How to find the maximum point of a line on a plot with multiple lines?

3 visualizaciones (últimos 30 días)
Produced a function with 4 equations and then used the plot function to plot them onto a graph (graph and code below).
function dx = Function(t, x)
dx = [0; 0; 0; 0];
m = 0.7;
n = 0.8;
o = 1;
p = 0.4;
dx(1) = -m * x(1)
dx(2) = m * x(1) + n * x(2) - o * x(2);
dx(3) = o * x(2);
dx(4) = p * x(2);
end
and
[t,x] = ode45('Function', [0 20], [400 0 0 0], options);
plot(t,x);
legend('A', 'B', 'C', 'D');
How do I identify the maximum point of line B (red line which rises and falls)?

Respuesta aceptada

Are Mjaavatten
Are Mjaavatten el 20 de Feb. de 2018
[mx,i] = max(x(:,2));
tmx = t(i);
hold on; plot(tmx,mx,'*r')

Más respuestas (0)

Categorías

Más información sobre Graph and Network Algorithms en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by