Seems pretty easy. Read the help, and look at the examples. Envelope is part of the signal processing toolbox.
t = linspace(0,5*pi,300);
sig = 2*sin(t) + sin(3*t) + randn(size(t))/50; % some noise for fun
[hi,lo] = envelope(sig);
plot(t,sig,'r-',t,hi,'g-',t,lo,'b-')
legend('Signal','upper','lower')
grid on
It can probably do better if I spend some time reading the help, but that is your job. I don't even have that toolbox.