Envelope function of a signal
8 views (last 30 days)
Show older comments
I have two sine signal with me and I wanted to find an envelope of both the signal. Could anyone tell me how to do that?
0 Comments
Accepted Answer
Star Strider
on 29 Oct 2022
t = linspace(0, 1, 1E+3);
s = sin(2*pi*t*5) .* sin(2*pi*t*100);
[senvu,senvl] = envelope(s, 10, 'peak');
figure
plot(t, s, 'DisplayName','Signal')
hold on
plot(t, senvu, '-m', 'LineWidth',2, 'DisplayName','Upper Envelope')
plot(t, senvl, '-c', 'LineWidth',2, 'DisplayName','Lower Envelope')
hold off
grid
.
2 Comments
Star Strider
on 29 Oct 2022
This is misspelled:
t=linespace(0,1,1E+3); % (for this line)
↑
Because of that, MATLAB does not recognise it as a function, and considers it a variable, throwing the error.
If you copy and paste my code exactly as I wrote it (perhaps using your own ‘s’ function instead), it should run without error.
.
More Answers (0)
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!