Envelope(s​ignal,np,'​peak') error in Matlab R2015b

I am trying to use the envelope function on MATLAB R2015b and I get the following error:
"Error using envelope
Too many input arguments.
Error in envelope_trial (line 7)
[up,low ]= envelope(x,30,'peak');"
x is simply a vector computed in this way:
"t = 0:1e-4:1; x = [1+cos(2*pi*50*t)].*cos(2*pi*1000*t);"
The MATLAB R2016b online documentation explains how to use this function and I am following striclty the instructions (https://es.mathworks.com/help/signal/ref/envelope.html#buv7i12-1).
What is the problem?

Answers (2)

Do you have another envelope function on your path? What does
which envelope
return? If it does not point to the one under toolbox/signal/signal, then another function with the same name is shadowing it.
HTH
This works for me
t = 0:1e-4:1;
x = [1+cos(2*pi*50*t)].*cos(2*pi*1000*t);
[up,low ]= envelope(x,30,'peak');
plot(t, x, 'b*-');
hold on;
plot(t, up, 'r*-');
plot(t, low, 'g*-');
Do this and tell me what you see:
>> which -all envelope
Do you see only this:
C:\Program Files\MATLAB\R2016b\toolbox\signal\signal\envelope.m

Tags

Asked:

on 14 Feb 2017

Answered:

on 14 Feb 2017

Community Treasure Hunt

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

Start Hunting!