How to plot cross-ambiguity function of this binary sequence?

4 views (last 30 days)
Hi
I want to plot cross-ambiguity function of this following sequence:
kasamiseq = comm.KasamiSequence('Polynomial',[6 5 4 1 0], ...
'InitialConditions',[ 0 0 0 0 0 1],'SamplesPerFrame', 63);
kasami_code = kasamiseq();
The parameters are PRF =50000, Sampling frequency = 100e+06.
Please guide me how to plot it.

Accepted Answer

Hassaan
Hassaan on 20 Jan 2024
% Parameters
PRF = 50000; % Pulse Repetition Frequency
Fs = 100e6; % Sampling Frequency
N = 63; % Length of Kasami sequence
% Generate a dummy Kasami sequence (random binary sequence)
kasami_code = 2 * (randi([0 1], 1, N) - 0.5);
% Time axis
t = (0:N-1) / Fs;
% Define delays and Doppler shifts for the cross-ambiguity function
delays = -N:N;
doppler_shifts = linspace(-PRF/2, PRF/2, 100);
% Initialize cross-ambiguity matrix
cross_ambiguity = zeros(length(delays), length(doppler_shifts));
% Compute cross-ambiguity function
for i = 1:length(delays)
for j = 1:length(doppler_shifts)
% Shift and Doppler shift the Kasami code
shifted_code = circshift(kasami_code, [0, delays(i)]) .* exp(-1i * 2 * pi * doppler_shifts(j) * t);
% Correlate with the original Kasami code
correlation = xcorr(kasami_code, shifted_code);
cross_ambiguity(i, j) = abs(correlation(floor(length(correlation)/2)));
end
end
% Plotting
imagesc(doppler_shifts, delays, abs(cross_ambiguity));
colorbar;
xlabel('Doppler Shift (Hz)');
ylabel('Delay (samples)');
title('Cross-Ambiguity Function of Kasami Sequence');
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Feel free to contact me.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!