⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 problem1-4.m

📁 Ultra.Wideband.Signals.and.Systems.in.Communication.Engineering.eBook-kB代码
💻 M
字号:
%
% Matlab File for Figure 1.5 a,b
%
%
%
clear all;
tau = .15;
tl=-1;th=1;tt=.01; % define the time parameters;
fac=10; % A factor for increasing the resolution of the frequency response
time = tl:tt:th;
mono=uwb_pulse(time,tau);
mono_forward=zeros(size(mono));
mono_back=zeros(size(mono));
for i=16:(201-30);
    mono_forward(i+15)=mono(i);
    mono_back(i-15)=mono(i);
end;
%
% If required, the following can be uncommented and used to see the single pulses
%
% figure(100)
% plot(time,mono,'r',time,mono_forward,'b',time,mono_back,'g')


% generate NP pulses
NP=100;
ttl=NP*tl;tth=NP*th; % define the time parameters;
time2=ttl:tt:tth;
cycle=zeros(size(time2));
for  i=1:NP;
    rn=rand(1);
    if (rn<0.5)
        for j=1:length(time)-1;
            cycle((i-1)*(length(time)-1)+j)=mono_forward(j);
        end;    
    else
        for j=1:length(time)-1;
            cycle((i-1)*(length(time)-1)+j)=mono_back(j);
        end;
        
    end;
%     for j=1:length(time)-1;
%         cycle((i-1)*(length(time)-1)+j)=mono(j);
%     end;
end;
% plot NP pulses
figure(1)
plot(time2,cycle);grid on;xlabel('Time, nsec');ylabel('Normalized Amplitude');
axis([-10 10 -0.5 1]);

% calculate spectrum of NP pulses
Y2=fft(cycle,round(fac*(tth-ttl)/tt))*tt;
Pspect2= Y2.* conj(Y2);
% normalize
Pspect2= Pspect2/max(Pspect2);
f = 1/fac/(tth-ttl):1/fac/(tth-ttl):1/tt;

% plot spectrum of NP pulses
figure(2)
semilogy(f,Pspect2);xlabel('Frequency, GHz');ylabel('Normalized Magnitude');
%plot(f,Pspect2);
grid on;
axis([0 (1/tt/2)*0.3 1e-5 1]);

⌨️ 快捷键说明

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