
How to create an envelope on a specific signal
9 次查看(过去 30 天)
显示 更早的评论
could anybody please guide me how i can find the lower & upper envelope on a signal? would you give me a simple example?thank you
0 个评论
采纳的回答
Star Strider
2015-1-29
Use the hilbert function:
t = linspace(0,5*pi,1000);
s = sin(t) .* cos(15*t);
hs = hilbert(s);
figure(1)
plot(t, s)
plot(t,-abs(hs),'r-', t,abs(hs),'-r', 'LineWidth',1.5)
hold off
grid
produces:

6 个评论
Saeed Haidar
2020-7-23
hello guys,
can someone help me create an envelope to my signal, here's the code:
fs = 44100;
c5=key(52,8,fs);
a4=key(49,8,fs);
b4=key(51,8,fs);
e4=key(44,8,fs);
e5=key(56,8,fs);
d5=key(54,8,fs);
f5=key(57,8,fs);
line1= [ e4 a4 b4 c5 a4 ];
line2= [ e4 a4 b4 c5 a4 ];
line3= [ e4 a4 b4 c5 b4 a4 c5 b4 a4 e5 e5 e5 d5 e5 f5 f5];
song=[line1 line2 line3];
sound(song,fs,24);
function wave= key(p,n,fs)
t=0:1/fs:4/n;
idx=440*2^((p-49)/12);
tt=4/n:1/fs:0;
wave=(sin(2*pi*idx*t)).*exp(tt);
wave=wave./max(wave);
end
Scott MacKenzie
2021-7-9
@Saeed Haidar. You comment is about something quite different -- adding an envelope (attack, sustain, decay) to the notes in a melody. If you are still interested in this, please post as a separate question.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!