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.
2 views (last 30 days)
Show older comments
[Rxx,lags]=xcorr(orignal_signal,reciever_signal);
d=finddelay(orignal_signal,reciever_signal);
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)
1 Comment
nick
on 2 Jan 2024
Kindly share the "original_signal" and "receiver_signal" or the entire code to effectively resolve the issue.
Answers (1)
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:
N=1000;
origSig=double(rand(1,N)>.05); % x=random sequence of 5% ones and 95% zeros
recSig=5.5;
xcorr(origSig,recSig)
Please show your code to if you need more assistance.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!