two signal one is original signal i.e. pulses and other is receiving signal with a noise. finding the delay in signal by using the cross correlation.

6 views (last 30 days)
I want to find the delay in the signal for real time application. so what are the following error and how can we resolve it.
An error occurred while running the simulation and the simulation was terminated
Caused by:
Maximum lag must be an integer. Error in xcorr.m (line 283) coder.internal.assert(maxlag == floor(maxlag), ... Error in xcorr.m (line 87) Error in 'untitled/MATLAB Function' (line 11)

Answers (1)

William Rose
William Rose on 27 Jan 2024
The error above occurs if you pass a non-integer scalar value for receiver_signal, because a scalar is interpreted as maxlags, which must be an integer.
Example which demonstrates the error you observed:
origSig=double(rand(1,N)>.05); % x=random sequence of 5% ones and 95% zeros
Error using matlab.internal.math.parseXcorrOptions
Maximum lag must be an integer.

Error in xcorr (line 72)
Please show your code to if you need more assistance.


Find more on Signal Generation and Preprocessing 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!