How to create an envelope on a specific signal

24 次查看(过去 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

采纳的回答

Star Strider
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
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
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 CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by