"Undefined function 'times' for input arguments of type 'channel.rician'" error on MATLAB, how to fix it?
1 次查看(过去 30 天)
显示 更早的评论
When i run the following code, i have an error, what is the problem? Here is the code:
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)') ;
And this is the error:
Undefined function 'times' for input arguments of type 'channel.rician'
0 个评论
回答(2 个)
Walter Roberson
2017-1-8
You cannot multiply a channel model by a value. You can use the channel model to generate samples and multiply the samples.
2 个评论
Walter Roberson
2017-1-8
Sorry, I mistook it for being one of the random noise channels.
You have to use the ricianchan object to filter samples; you can then multiply the filtered samples.
Depending on your purpose in doing the multiplication, you might consider instead changing the AvgPathGaindB property of the channel.
Honglei Chen
2017-1-9
You don't want to multiply the channel with the signal. Instead, you want to filter the signal with the channel, like the following:
r = filter(c1,rx)
HTH
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!