'xcorr' unable to use
Show older comments
I tried to calculate the xcorr and i got the 'Undefined function 'xcorr' for input arguments of type 'double'
I tried this example from the MathWorks documentation:
n = 0:15;
x = 0.84.^n;
y = circshift(x,5);
[c,lags] = xcorr(x,y);
stem(lags,c);
4 Comments
Walter Roberson
on 22 Mar 2020
Which MATLAB version are you using?
Image Analyst
on 22 Mar 2020
Edited: Image Analyst
on 22 Mar 2020
Worked for me. What does this show
>> which -all xcorr
Do you see this:
C:\Program Files\MATLAB\R2020a\toolbox\matlab\datafun\xcorr.m
C:\Program Files\MATLAB\R2020a\toolbox\matlab\bigdata\@tall\xcorr.m % tall method
C:\Program Files\MATLAB\R2020a\toolbox\parallel\gpu\@gpuArray\xcorr.m % gpuArray method
If not, is your script also named xcorr.m?
If you don't see the one in the datafun folder, try this:
>> restoredefaultpath
Jasmin Ittner
on 22 Mar 2020
Image Analyst
on 22 Mar 2020
I'd call and ask them. From what I showed, it seems to be part of base MATLAB now, not part of the Signal Processing Toolbox anymore (which I have). Your version is an antique - 6.5 years old. Can you upgrade it? Otherwise you can always write your own xcorr function - it's not hard, try it.
Answers (1)
Walter Roberson
on 22 Mar 2020
0 votes
Up to R2018b, xcorr was part of the Signal Processing Toolbox; as of R2019a it was moved into basic MATLAB.
The signal toolbox must be purchased?
For your version, it would have to be. However, it is no longer possible to purchase toolboxes for versions that old. You would need to upgrade to the current release, and if you did that then you would not need te signal processing toolbox.
You might be able to take advantage of some of the File Exchange contributions, such as
Categories
Find more on Correlation and Convolution 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!