📄 pr6_41.m
字号:
%Problem 6.41;
%ACF and spectrum of LFM signal;
clear all; close all;
WD=[10 25 40]; %vector of deviations;
t=[0:0.001:1.999]; N=length(t); %time scale;
RE=[ones(1,1000),zeros(1,1000);exp(-16*(t-0.5).^2)]; %rectangular and bell-shaped real envelopes;
Env=RE(2,:); %chosing real envelope;
car=exp(i*2*pi*t*50); %carrier for spectrum shift (better visualization);
for k=1:3
S=Env.*exp(i*pi*WD(k)*((t-0.5).^2)); Racr=abs(xcorr(S))/(S*S'); Racr=Racr(N/2:3*N/2-1); %calculation of accurate ACF;
Rapp=abs(sin(pi*WD(k)*(t-1))./(pi*WD(k)*(t-1+eps))); %approximate ACF;
TT=['Wd=',num2str(WD(k))];
subplot(3,2,2*k-1); plot(t-1,Racr,'b',t-1,Rapp,'r'); ylabel('ACF'); xlabel('\tau'); ylim([-0.2,1.2]); text(-0.9,0.9,TT); grid;
if Env==RE(1,:) legend('accurate','approx'); else legend('bell','rect'); end; %plotting ACF
Sp=abs(fft(S.*car)).^2; Sp=Sp(1:200)/max(Sp); %energy spectrum of the signal;
subplot(3,2,2*k); plot([0:199]/2,Sp); ylabel('energy spectrum'); xlabel('f'); ylim([-0.2,1.2]); text(5,0.9,TT); grid; %plotting spectrum;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -