pr6_42.m

来自「Spread Spectrum and CDMA Principles and 」· M 代码 · 共 22 行

M
22
字号
%Problem 6.42;
%ambiguity function and chart of LFM and VLFM pulses;

clear all; close all;
t=[-1:0.01:1];  N=length(t); %time scale;
WD=25; %frequency deviation in number of 1/T;
S=[exp(i*pi*t.^2*WD);[exp(i*pi*t(1:101).^2.*WD) exp(-i*pi*t(102:201).^2.*WD)]]; %complex envelopes of LFM and VLFM pulses;
F=[0:0.1:2*WD]; L=length(F); %frequency scale;
F1=[-F(L:-1:2),F];
for k=1:2 %the loop fulfils the same for both sorts of signals;
    Sk=S(k,:); %selects one of signals;
    AM=[]; %clears matrix of ambiguity function values;
    Sf=kron(ones(L,1),Sk).*exp(-i*2*pi*F'*t); Sf=[Sf,zeros(L,N-1)]; %prepares array of frequency shifted signals;
    AM=abs(filter(Sk(N:-1:1),1,Sf'))/(Sk*Sk'); AM=AM'; %calculates ambiguity function;
    AM=[AM(L:-1:2,2*N-1:-1:1);AM]; %spreads ambiguity function from half-plane onto the plane;
    subplot(2,2,2*k-1); mesh([-2:0.01:2],F1,AM); xlabel('\tau/T'); ylabel('FT'); %plots ambiguity function;
    subplot(2,2,2*k), contourf([-2:0.01:2],F1,AM,[0.3,0.6]); xlabel('\tau/T'); ylabel('FT'); grid; %plots ambiguity charts at 2 levels;
end;
    
    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?