2017-01-08 3 views
0

次のコードを実行するとエラーが発生しますが、何が問題なのですか?どのように私はそれを修正することができますか?ここでは、コードは次のようになります。"'channel.rician'タイプの入力引数が未定義の関数 'times'です.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' 

問題は何ですか?

答えて

0

問題は、このライン上で発生する:c1は私が精通していないよchannel.ricianの種類を、持っていながら、ここで

r=c1.*rx; 

は、rxは、(複雑な)ベクトルです。あなたが前の行に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; 
で誤った行を置き換えることを言ってみましょう