📄 uwb_channel.m
字号:
%function y=UWB_channel(input,fc)
N=3; %Number of multipath
ns=1e-9;%nano-
M=1e6;%Mega-
fc=3939e6;%Central freq.
a=1;%Amplitude set unit here
[x,mn,mx,fs]=Gaussian_trend2(0.025*ns,fc,5);% carrier pulse trend with chiprate=fc/3
% segma=0.025ns,
% fs is sample frquency
sg=10^(3/10);% the attenuation factor alpha's std.
data=[1,-1,0,1,1];
d=p_shaping(data,10);
m=d.*x;
t=mn:1/fs:mx;%sample time duration is the full length of trend
n=sg*randn;% Normal distribution with segma equal to sg.
X=10^(n/20);%log-normal shadowing factor
h=zeros(1,length(t));
for i=1:N
mag_alpha=10^(sg*randn/10);%magnitude of alpha with log-normal distribution
ang_alpha=pi*rand;%angle of alpha with uniform distribution
alpha=mag_alpha*exp(ang_alpha);
T=pi*rand*10^-9;%Delay T
pos=max(find(T>=t))+1;%find the smallest time point which greater than T
h(pos)=h(pos)+alpha*X;
end
figure;
subplot(2,1,1)
plot(t,h);
H=fft(h,1024);
Ph=H.*conj(H)/1024;
fh=fs*(0:512)/1024;
subplot(2,1,2)
semilogy(fh,Ph(1:513));
%% convolove the data with channal impulse response
y=conv(h,m);
figure;
t2=0:1/fs:(length(y)-1)/fs;
plot(t2,y);
figure;
subplot(2,1,1)
stem(t,d);
subplot(2,1,2)
plot(t,m);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -