📄 sui_3_channel.m
字号:
%implementation of the SUI-3 omni antenna channel
%Part 1 is generation of channel coeeficient using rician channel modle
clc;
N = 10000; %number of independent random realizations
OR = 4; %observation rate in Hz
M = 256; %number of taps of the Doppler filter
Dop_res = 0.1;% Doppler resolution of SUI parameter in Hz (used in resampling-process)
res_accu = 20; %accuracy of resampling process
P = [ 0 -5 -10 ];% power in each tap in dB
K = [ 1 0 0 ]; %Ricean K-factor in linear scale
tau = [ 0.0 0.5 1.0 ];% tap delay in micro second
Dop = [ 0.4 0.4 0.4 ]; %Doppler maximal frequency parameter in Hz
ant_corr = 0.4; %antenna correlation (envelope correlation coefficient)
Fnorm = -1.5113; %gain normalization factor in dBP = 10.^(P/10); % calculate linear power
P = 10.^(P/10); % calculate linear power
s2 = P./(K+1); % calculate variance
m2 = P.*(K./(K+1)); % calculate constant power
m = sqrt(m2); % calculate constant part
%Additional Info: RMS delay spread
rmsdel = sqrt( sum(P.*(tau.^2))/sum(P) - (sum(P.*tau)/sum(P))^2 )
fprintf('rms delay spread %6.3f ?s\n', rmsdel);%Now we can create the Ricean channel coefficients with the specified powers.
L = length(P); % number of taps
paths_r = sqrt(1/2)*(randn(L,N) + j*randn(L,N)).*((sqrt(s2))' * ones(1,N));
paths_c = m' * ones(1,N);
for p = 1:L
D = Dop(p) / max(Dop) / 2 % normalize to highest Doppler
f0 = [0:M*D]/(M*D) % frequency vector
PSD = 0.785*f0.^4 - 1.72*f0.^2 + 1.0;
% PSD approximation
filt = [ PSD(1:end-1) zeros(1,M-2*M*D) PSD(end:-1:2) ]
length(filt)
filt = sqrt(filt); % from S(f) to |H(f)|
%figure(1)
%plot(f0,filt(1:129)),xlabel('normalized frequency'),ylabel('gain'),title('Power Spectral Density');% S(f)
filt = ifftshift(ifft(filt)); % get impulse response
figure(1)
plot(0:length(filt)-1,filt);
filt = real(filt); % want a real-valued filter
filt = filt / sqrt(sum(filt.^2)); % normalize filter
path = fftfilt(filt, [ paths_r(p,:) zeros(1,M) ]);
length(path)
paths_r(p,:) = path(1+M/2:end-M/2);
end;
length(paths_r(1,:))
paths = paths_r + paths_c;
paths = paths * 10^(Fnorm/20); % multiply all coefficients with F
%Additional Info: average total tap power
Pest = mean(abs(paths).^2, 2);
fprintf('tap mean power level: %0.2f dB\n', 10*log10(Pest));
%Additional Info: spectral power distribution
figure,psd(paths(1,:), 512, max(Dop));
%Part 2 is the generation of random signal
sig=rand(1,20000)>0.5;
sig=reshape(sig,length(sig)/2,2);
sig=bi2de(sig,'left-msb')';
j=sqrt(-1);
sig_mod=[];
for i=1:10000
if sig[i]==1
gsig_mod(i)= -1+j;
elseif sig[i]==0
sig_mod(i)=-1-j;
elseif sig[i]==2
sig_mod(i)=1-j;
else
sig_mod(i)=1+j;
end
end
% prompt = {'delay spread:'};
% dlg_title = 'Input for delay spread';
% num_lines =1;
% def = {''};
% delta_tau= inputdlg(prompt,dlg_title,num_lines,def);
%delta_tau=input('enter the value of delay spread :','s');
%Part 3 is implementaion of the channel model using tapped delay line model
delta_tau=rmsdel; %normalized value for max delay spread
ts=1;
alpha_3=sinc(((tau(3)-tau(2))/ts)-(-3:1:3));
alpha_2=sinc(((tau(2)-tau(1))/ts)-(-3:1:3));
alpha_1=sinc(-3:1:3);
alpha=[alpha_1' alpha_2' alpha_3'];
%rician coefficent of the channel
a1=paths(1,:);
a2=paths(2,:);%gain for path 2
a3=paths(3,:);
a=[a1;a2;a3];
g=alpha*a;
u=[sig_mod;0 sig_mod(1:9999);0 0 sig_mod(1:9998);0 0 0 sig_mod(1:9997);0 0 0 0 sig_mod(1:9996);0 0 0 0 0 sig_mod(1:9995);0 0 0 0 0 0 sig_mod(1:9994)];
y=sum(g.*u,1);
figure(3)
plot(1:100,y(1:100));
y=fft(y,16384);
Pyy = y.* conj(y) /16384;
figure(4)
subplot(2,1,1)
plot((0:4999)*0.8/16384,Pyy(1:5000));
%hist(y);
%stem(1:100,20*log10(abs(y(1:100))))
subplot(2,1,2)
plot(0:1/20:10,10*log10(a1(1:201)),'-r'), xlabel('time'),ylabel('tap gain in db');
hold on
plot(0:1/20:10,10*log10(a2(1:201)),'-g'),plot(0:1/20:10,10*log10(a3(1:201)))
title('Tap of the channel');legend('Tap 1','Tap 2','Tap 3');
hold off;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -