How to fix Rician Channel Model Error?
9 次查看(过去 30 天)
显示 更早的评论
I am using the rician channel model directly from the tutorial from MATLAB.
Then i decided to change up the last line of code: ricianchan(channelInput)
I changed ChannelInput to a bpsk modulated signal. It is any number of characters (the user can input any text they want, then it is changed to 8 bits per character) then adding a Hamming(7,4) code. This creates 14 bits per character.
so ChannelInput is still inputing modulated data, but I am getting an error.
Error: Number of Columns of the signal input must be equal to the number of transmit antennas.
How do I go about changing the number of transmit antennas? The tutorial has channel input length of 1024, but if i give it any other length it fails. How would I go about changing this so it can be used with a dynamic input?
Thank you.
0 个评论
回答(1 个)
Shushant
2023-2-17
Hi @Nick,
My understanding of your problem is that you want to make the "ricianchan" function execute with dynamic input which is generated by converting the text into 14 bits per character and then modulated using "bpskModulator". I have tried to achieve this by using a dynamic string "s" changing it to a 14 bits per character array, passing it to the "bpskModulator" and then running the function "ricianchan". The function does work without any issues with dynamic input length. As you can observe with the code below.
s='abcdefgh'
p=dec2bin(double(s),14)'
out=double(p(:))-48
pskModulator = comm.PSKModulator;
bpskModulator = comm.BPSKModulator;
%insig = randi([0,pskModulator.ModulationOrder-1],1024,1)
%data = randi([0 1],100,1);
%channelInput = pskModulator(insig);
modData = bpskModulator(out);
ricianchan = comm.RicianChannel( ...
'SampleRate',1e6, ...
'PathDelays',[0.0 0.5 1.2]*1e-6, ...
'AveragePathGains',[0.1 0.5 0.2], ...
'KFactor',2.8, ...
'DirectPathDopplerShift',5.0, ...
'DirectPathInitialPhase',0.5, ...
'MaximumDopplerShift',50, ...
'DopplerSpectrum',doppler('Bell', 8), ...
'RandomStream','mt19937ar with seed', ...
'Seed',73, ...
'PathGainsOutputPort',true);
[RicianChanOut1,RicianPathGains1] = ricianchan(modData)
release(ricianchan);
ricianchan.RandomStream = 'Global stream';
rng(73)
[RicianChanOut2,RicianPathGains2] = ricianchan(modData);
isequal(RicianChanOut1,RicianChanOut2)
I suggest you recheck your code as the function "ricianchan" has no issues with input of dynamic length.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Propagation and Channel Models 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!