MATLAB: How to create an envelop from three graphs

envelopplotting

How can i create an envelop for three different Signals. the edges around the three signals that are top most, so there is an envelop around all three but forming 1 plot around all three. All three signals are plotted on the same graph

Best Answer

For the most trivial case, when the three lines share the same X-values and are provides as vectors:
x = 1:100;
y1 = rand(1, 100);
y2 = rand(1, 100);
y3 = rand(1, 100);
joined = cat(1, y1, y2, y3);
env_max = max(joined, [], 1);
env_min = min(joined, [], 1);
plot(x, joined);
hold('on');
plot(x, env_max, 'k');
plot(x, env_min, 'k');