"Undefined function 'times' for input arguments of type 'channel.rician'" MATLAB 上的错误,如何修复?



当我运行以下代码时,我遇到了错误,问题是什么? 我该如何解决它?这是代码:

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'

问题出在哪里??

问题出现在这一行:

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;

最新更新