当我运行以下代码时,我有一个错误,有什么问题?我该如何解决?这是代码:
clear all; close all; clc;
% basic inputs =============================
fc=2e9; % Hz Carrier frequency
F=16; % sampling rate: fraction of wave length
V=10; % m/s MS1 speed
NFFT=128; % Number of points in FFT
Nsamples=100; % Number of samples
% geometry inputs ===========================
dBS=1000; % distance of BS to origin
alpha = 180; % degree. Angle of BS-MS with MS route
% inidirect gemeotric parameters ================
BSx=dBS*cosd(alpha); % loc of BS x-coord
BSy=dBS*sind(alpha); % loc of BS y-coord
% indirect parameters ===========================
c=3e8;
lambdac=c/fc; % m wavelength
Dx=lambdac/F; % m sampling spacing
ts=Dx/V; % s time sampling interval
fs=1/ts; % Hz sampling frequency
kc=2*pi/lambdac; % propagation constant
timeaxis=ts.*[0:Nsamples]; % s elapsed time axis
disaxis=Dx.*[0:Nsamples]; % n traveled distance axis
MSx=V.*timeaxis; % MS route sampling points
% radio path length==============================
distBSMS=sqrt((BSx-MSx).^2+(BSy).^2);
% complex envelope: amplitude and phase ===============
rx=1*exp(-1j*kc.*distBSMS)-exp(-1j*2*pi/(c./5e9).*distBSMS);
c1 = ricianchan;
r=c1.*rx;
% complex envelope spectrum ======================
spectrumr=fftshift((abs(fft(r,NFFT))).^2);
freqaxis=[0:NFFT-1]*fs/NFFT-fs/2;
% Plots =====================================
figure,plot(timeaxis,abs(r))
xlabel('Time (s)') ;
这就是错误:
Undefined function 'times' for input arguments of type 'channel.rician'
问题是什么?
答案 0 :(得分:0)
问题出在这一行:
r=c1.*rx;
此处,rx
是(复数)向量,而c1
的类型为channel.rician
,我不熟悉。您在上一行定义c1
:
c1 = ricianchan;
这应该给你什么?如果只需在命令窗口中键入c1
,就可以看到c1
的哪些字段可用:
>> c1
c1 =
ChannelType: 'Rician'
InputSamplePeriod: 1
DopplerSpectrum: [1x1 doppler.jakes]
MaxDopplerShift: 0
PathDelays: 0
AvgPathGaindB: 0
KFactor: 1
DirectPathDopplerShift: 0
DirectPathInitPhase: 0
NormalizePathGains: 1
StoreHistory: 0
StorePathGains: 0
PathGains: 1.0657 + 0.8151i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 0c1 =
ChannelType: 'Rician'
InputSamplePeriod: 1
DopplerSpectrum: [1x1 doppler.jakes]
PathDelays: 0
AvgPathGaindB: 0
KFactor: 1
DirectPathDopplerShift: 0
DirectPathInitPhase: 0
NormalizePathGains: 1
StoreHistory: 0
StorePathGains: 0
PathGains: 1.0657 + 0.8151i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 0MaxDopplerShift: 0
PathDelays: 0
AvgPathGaindB: 0
KFactor: 1
DirectPathDopplerShift: 0
DirectPathInitPhase: 0
NormalizePathGains: 1
StoreHistory: 0
StorePathGains: 0
PathGains: 1.0657 + 0.8151i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 0
让我们说你真正想要的是复数PathGains
,然后用
r=c1.PathGains.*rx;