How can I get the maximum line of multiple graphs, starting from different x-values?
Mostrar comentarios más antiguos
Hi everyone! I really don´t know what else to do! I have a lot of graphs from different matrix and on one hand i want to fill the area between the maximum line and the minimum line, on the other i need to extract the data from x- and y-values from these lines. Let me give you an example to make it more clear what i exactly need:
if you have something like that:
hold on;
t =0:0.01:2*pi;
x=sin(t);
hL(1)=plot(t-0.5,x+1);
hL(2)=plot(t+0.5,x+1);
hL(3)=plot(t,x);
hL(4)=plot(t-0.5, x-1);
hL(5)=plot(t+0.5, x-1);
you get this graph:

and what i need now is:
getting the point values from the marked lines, and fill the area in between!

I already read this answer, but still can´t find a solution for my problem. MathWorks
Thank you in advance!
Respuesta aceptada
Más respuestas (1)
Gareth
el 11 de Dic. de 2018
Maybe I miss understood but you could use min and max to achieve this:
t = 0:.1:2*pi;
for i = 1:4, y(i,:) = sin(t*i*2*pi);end;
plot(t,y)
% now to get the max
figure,
plot(t,max(y))
% now for min
figure
plot(t,min(y))
I hope that this helps
3 comentarios
Khalil Gabsi
el 11 de Dic. de 2018
Gareth
el 11 de Dic. de 2018
Sorry:( but now I think I understand:
clear all
t = 0:.1:2*pi;
for i = 1:4, y(i,:) = sin(t*2*pi+i);end
plot(t,y)
figure
patch([t fliplr(t)]',[min(y) max(y)]','r')
Khalil Gabsi
el 11 de Dic. de 2018
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

