如何用matlab进行编程排序:Matlab学习打卡13位巴克吗
如何用matlab进行编程排序:Matlab学习打卡13位巴克吗delay = linspace(-tau tau nfft);u(1:samp_num) = kron(Barker_code ones(1 10));n = ceil(log(samp_num)/log(2));nfft = 2^n;u(1:nfft) = 0;
function [amf] = af_barker(Barker_code T)
N = length(Barker_code);
tau = N*T;
samp_num = size(Barker_code 2)*10;
n = ceil(log(samp_num)/log(2));
nfft = 2^n;
u(1:nfft) = 0;
u(1:samp_num) = kron(Barker_code ones(1 10));
delay = linspace(-tau tau nfft);
subplot(2 3 1) plot(delay*1e6 N u) grid on;
sampling_interval = tau/nfft;
freqlimit = tau/nfft;
f = linspace(-freqlimit freqlimit nfft);
freq = fft(u nfft);
vfft = freq;
freq = abs(freq)/max(abs(freq));
subplot(2 3 2) plot(f*1e-6 fftshift(freq));grid on;
freq_del = 12/tau/100;
freql = -6/tau:freq_del: 6/tau;
for k = 1:length(freql)
sp = u.*exp(1j*2*pi*freql(k).*delay);
ufft = fft(sp nfft);
prod = ufft.*conj(vfft);
amf(k :) = fftshift(abs(ifft(prod)));
end
amf = amf./max(max(amf));
[m n] = find(amf == 1.0);
subplot(2 3 3)
%[X Y] = meshgrid(delay*1e6 freq1*1e-6);
mesh(delay*1e6 freql*1e-6 amf);
subplot(2 3 4) contour(delay*1e6 freql*1e-6 amf 1 'b');grid on;
subplot(2 3 5) plot(delay*1e6 amf(m :) 'k');grid on;
subplot(2 3 6) plot(freql*1e-6 amf(: n) 'k');