📄 mulpathpowerspectrum.m
字号:
%multiply path fade channel
clear all;
close all;
f0=10 ; %调制信号频率10hz
fdm=20; %最大多普勒频率20hz
fc=1000000; % 载频1Mhz
N1=1024; %做N1点的fft---the dots num of fft
n=0:N1-1;
t=0.01*n; %time dots
q=n*2*pi/N1; %频率间隔
L=20; %多经数num of path
taof=2*rand(1,L); % 时延变化频率 veciliate of time-dlay-frency
fai0=rand(1,L)*2*pi; % 多径初相original phase of path
st=cos(2*pi*f0*t);
for i=1:L
fai(i,: )=cos(2*pi*taof(i)*t); % 不同方法的核心区别
% the core difference of different method
s(i,: )=cos(fai0(i)).^2*cos(2*pi*fc*t+fdm*cos(2*pi*i/L)*t+fai0(i)) ;% 第i条路径之信号的表达式
% the signal function of the ith channel
end
rt=sqrt(2/L)*sum(s); %to sumrize 20 paths' signal
sf=fft(st,N1);
rf=fft(rt,N1);
figure(1)
subplot(211)
plot(t,st);
xlabel('t');
ylabel('s(t)');
title('输入之单一频率信号');
axis([0 1 -1.5 1.5]);
subplot(212)
plot(t,rt);
xlabel('t');
ylabel('r(t)');
axis([0 10 -3 3]);
title('经过20路多径后输出的信号');
figure(2)
subplot(211)
plot(q,abs(sf));
xlabel('f');
ylabel('s(f)');
title('输入之单一频率信号s(t)之幅度谱');
axis([0.5 1 0 200]);
subplot(212);
plot(q,abs(rf));
xlabel('f');
ylabel('r(f)');
axis([0 0.3 0 200]);
title('经过20路多径后输出的信号之幅度谱');
figure(3)
subplot(211)
plot(q,angle(sf));
xlabel('f');
ylabel('S(f)');
title('输入之单一频率信号相位谱');
axis([0 7 -3.142 3.142]);
subplot(212)
plot(q,angle(rf));
xlabel('f');
ylabel('R(f)');
axis([0 0.4 -3.142 3.142]);
title('经过20路多径后输出的信号之相位谱');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -