Complex valued signal simulation
32 views (last 30 days)
I have created codes to plot the cross correlation between two shifted signal as below.....But I want to create a complex-valued Matlab simulation and see the result....the codes below are only real-valued samples.
Could anyone advice how can I do it?
Thanks in advance.
- clear; clc; close all;
- fs = 5e3;
- fc = 100;
- time_vector = 0:1/fs:1;
- sig1 = sin(2*pi*fc*time_vector);
- sig2 = zeros(1,length(sig1));
- sig_tx = [sig1 sig2];
- sample_delay = 6e3; %change this value to observe correlator output for different amount of sample shifts
- sig_rx = circshift(sig_tx,sample_delay);
- r = xcorr(sig_tx,sig_rx);
- [~,I] = max(r);