필터 지우기
필터 지우기

How to fix Rician Channel Model Error?

조회 수: 10 (최근 30일)
Nick
Nick 2023년 2월 1일
답변: Shushant 2023년 2월 17일
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.

답변 (1개)

Shushant
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'
s = 'abcdefgh'
p=dec2bin(double(s),14)'
p = 14×8 char array
'00000000' '00000000' '00000000' '00000000' '00000000' '00000000' '00000000' '11111111' '11111111' '00000000' '00000001' '00011110' '01100110' '10101010'
out=double(p(:))-48
out = 112×1
0 0 0 0 0 0 0 1 1 0
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)
RicianChanOut1 =
-0.0083 - 0.0167i 0.0016 + 0.0043i -0.0105 - 0.0222i 0.0046 + 0.0121i -0.0151 - 0.0342i 0.0128 + 0.0329i -0.0346 - 0.0809i 0.2723 + 0.8784i 0.4936 + 1.0832i 0.4668 + 0.9761i 0.4800 + 1.0208i 0.4778 + 1.0119i 0.4659 + 0.9824i 0.5267 + 1.1235i -0.0253 - 0.6488i -0.5657 - 1.2929i 0.0289 + 0.6924i 0.5332 + 1.2055i 0.4042 + 0.8216i 0.5745 + 1.2555i -0.1135 - 0.8687i 0.0111 + 0.5524i 0.5347 + 1.2390i 0.4455 + 0.9042i 0.5015 + 1.0836i 0.4540 + 0.9545i 0.4949 + 1.0495i 0.4727 + 1.0109i 0.0257 - 0.5362i -0.6196 - 1.4177i 0.0990 + 0.8549i 0.4378 + 0.9797i 0.5545 + 1.1860i -0.1014 - 0.8270i -0.0138 + 0.4904i 0.5610 + 1.3038i 0.4189 + 0.8425i 0.5274 + 1.1467i 0.4392 + 0.9156i 0.5036 + 1.0831i 0.4538 + 0.9523i 0.5233 + 1.1240i -0.0098 - 0.6134i -0.5955 - 1.3663i 0.0692 + 0.7864i 0.4770 + 1.0744i 0.4985 + 1.0528i -0.0074 - 0.5985i -0.5944 - 1.3681i 0.0806 + 0.8081i 0.4871 + 1.0992i 0.4801 + 1.0046i 0.4738 + 1.0148i 0.4926 + 1.0462i 0.4397 + 0.9331i 0.5318 + 1.1445i -0.0293 - 0.6596i -0.5495 - 1.2598i 0.0050 + 0.6275i 0.5874 + 1.3476i -0.1218 - 0.9002i -0.0002 + 0.5328i 0.5350 + 1.2456i 0.4452 + 0.9078i 0.5004 + 1.0870i 0.4649 + 0.9798i 0.4885 + 1.0459i 0.4790 + 1.0210i 0.4513 + 0.9572i 0.5515 + 1.1885i -0.0654 - 0.7367i -0.5256 - 1.2077i -0.0245 + 0.5581i 0.6262 + 1.4437i -0.1775 - 1.0369i 0.0944 + 0.7632i -0.0469 - 0.6152i -0.0335 + 0.4080i 0.5683 + 1.3455i 0.4179 + 0.8366i 0.5230 + 1.1459i 0.4516 + 0.9499i 0.4900 + 1.0481i 0.4966 + 1.0702i -0.0067 - 0.6058i -0.5789 - 1.3337i 0.0452 + 0.7219i 0.5314 + 1.2161i -0.0285 - 0.6711i -0.5809 - 1.3322i 0.0565 + 0.7473i 0.5130 + 1.1676i 0.4532 + 0.9454i 0.4992 + 1.0812i 0.4610 + 0.9763i 0.5008 + 1.0798i 0.4492 + 0.9499i 0.5468 + 1.1846i -0.0419 - 0.6841i -0.5550 - 1.2815i 0.0157 + 0.6524i 0.5701 + 1.3123i -0.0843 - 0.8079i -0.4869 - 1.1029i -0.5251 - 1.1195i 0.0355 + 0.6655i 0.5209 + 1.2048i 0.4523 + 0.9376i 0.5118 + 1.1106i 0.4375 + 0.9317i 0.4983 + 1.0701i 0.4774 + 1.0270i
RicianPathGains1 =
0.1402 + 0.5878i 0.2558 + 0.5110i 0.0842 - 0.0842i 0.1402 + 0.5878i 0.2557 + 0.5111i 0.0842 - 0.0842i 0.1403 + 0.5878i 0.2557 + 0.5112i 0.0842 - 0.0842i 0.1403 + 0.5878i 0.2557 + 0.5113i 0.0842 - 0.0842i 0.1403 + 0.5878i 0.2557 + 0.5114i 0.0842 - 0.0842i 0.1403 + 0.5878i 0.2556 + 0.5115i 0.0841 - 0.0842i 0.1404 + 0.5879i 0.2556 + 0.5116i 0.0841 - 0.0842i 0.1404 + 0.5879i 0.2556 + 0.5117i 0.0841 - 0.0842i 0.1404 + 0.5879i 0.2555 + 0.5118i 0.0841 - 0.0842i 0.1404 + 0.5879i 0.2555 + 0.5119i 0.0841 - 0.0843i 0.1405 + 0.5879i 0.2555 + 0.5120i 0.0841 - 0.0843i 0.1405 + 0.5880i 0.2554 + 0.5121i 0.0841 - 0.0843i 0.1405 + 0.5880i 0.2554 + 0.5122i 0.0841 - 0.0843i 0.1405 + 0.5880i 0.2554 + 0.5123i 0.0841 - 0.0843i 0.1406 + 0.5880i 0.2554 + 0.5124i 0.0841 - 0.0843i 0.1406 + 0.5880i 0.2553 + 0.5124i 0.0841 - 0.0843i 0.1406 + 0.5880i 0.2553 + 0.5125i 0.0841 - 0.0843i 0.1406 + 0.5881i 0.2553 + 0.5126i 0.0841 - 0.0843i 0.1407 + 0.5881i 0.2552 + 0.5127i 0.0841 - 0.0843i 0.1407 + 0.5881i 0.2552 + 0.5128i 0.0840 - 0.0843i 0.1407 + 0.5881i 0.2552 + 0.5129i 0.0840 - 0.0843i 0.1407 + 0.5881i 0.2551 + 0.5130i 0.0840 - 0.0843i 0.1408 + 0.5881i 0.2551 + 0.5131i 0.0840 - 0.0844i 0.1408 + 0.5882i 0.2551 + 0.5132i 0.0840 - 0.0844i 0.1408 + 0.5882i 0.2551 + 0.5133i 0.0840 - 0.0844i 0.1409 + 0.5882i 0.2550 + 0.5134i 0.0840 - 0.0844i 0.1409 + 0.5882i 0.2550 + 0.5135i 0.0840 - 0.0844i 0.1409 + 0.5882i 0.2550 + 0.5136i 0.0840 - 0.0844i 0.1409 + 0.5882i 0.2549 + 0.5137i 0.0840 - 0.0844i 0.1410 + 0.5883i 0.2549 + 0.5138i 0.0840 - 0.0844i 0.1410 + 0.5883i 0.2549 + 0.5139i 0.0840 - 0.0844i 0.1410 + 0.5883i 0.2548 + 0.5140i 0.0840 - 0.0844i 0.1410 + 0.5883i 0.2548 + 0.5141i 0.0839 - 0.0844i 0.1411 + 0.5883i 0.2548 + 0.5142i 0.0839 - 0.0844i 0.1411 + 0.5884i 0.2548 + 0.5143i 0.0839 - 0.0844i 0.1411 + 0.5884i 0.2547 + 0.5144i 0.0839 - 0.0844i 0.1411 + 0.5884i 0.2547 + 0.5145i 0.0839 - 0.0845i 0.1412 + 0.5884i 0.2547 + 0.5146i 0.0839 - 0.0845i 0.1412 + 0.5884i 0.2546 + 0.5147i 0.0839 - 0.0845i 0.1412 + 0.5884i 0.2546 + 0.5148i 0.0839 - 0.0845i 0.1412 + 0.5885i 0.2546 + 0.5149i 0.0839 - 0.0845i 0.1413 + 0.5885i 0.2545 + 0.5150i 0.0839 - 0.0845i 0.1413 + 0.5885i 0.2545 + 0.5151i 0.0839 - 0.0845i 0.1413 + 0.5885i 0.2545 + 0.5152i 0.0839 - 0.0845i 0.1413 + 0.5885i 0.2545 + 0.5153i 0.0839 - 0.0845i 0.1414 + 0.5885i 0.2544 + 0.5153i 0.0839 - 0.0845i 0.1414 + 0.5886i 0.2544 + 0.5154i 0.0838 - 0.0845i 0.1414 + 0.5886i 0.2544 + 0.5155i 0.0838 - 0.0845i 0.1415 + 0.5886i 0.2543 + 0.5156i 0.0838 - 0.0845i 0.1415 + 0.5886i 0.2543 + 0.5157i 0.0838 - 0.0846i 0.1415 + 0.5886i 0.2543 + 0.5158i 0.0838 - 0.0846i 0.1415 + 0.5887i 0.2542 + 0.5159i 0.0838 - 0.0846i 0.1416 + 0.5887i 0.2542 + 0.5160i 0.0838 - 0.0846i 0.1416 + 0.5887i 0.2542 + 0.5161i 0.0838 - 0.0846i 0.1416 + 0.5887i 0.2542 + 0.5162i 0.0838 - 0.0846i 0.1416 + 0.5887i 0.2541 + 0.5163i 0.0838 - 0.0846i 0.1417 + 0.5887i 0.2541 + 0.5164i 0.0838 - 0.0846i 0.1417 + 0.5888i 0.2541 + 0.5165i 0.0838 - 0.0846i 0.1417 + 0.5888i 0.2540 + 0.5166i 0.0838 - 0.0846i 0.1417 + 0.5888i 0.2540 + 0.5167i 0.0838 - 0.0846i 0.1418 + 0.5888i 0.2540 + 0.5168i 0.0837 - 0.0846i 0.1418 + 0.5888i 0.2539 + 0.5169i 0.0837 - 0.0846i 0.1418 + 0.5888i 0.2539 + 0.5170i 0.0837 - 0.0846i 0.1418 + 0.5889i 0.2539 + 0.5171i 0.0837 - 0.0847i 0.1419 + 0.5889i 0.2539 + 0.5172i 0.0837 - 0.0847i 0.1419 + 0.5889i 0.2538 + 0.5173i 0.0837 - 0.0847i 0.1419 + 0.5889i 0.2538 + 0.5174i 0.0837 - 0.0847i 0.1419 + 0.5889i 0.2538 + 0.5175i 0.0837 - 0.0847i 0.1420 + 0.5889i 0.2537 + 0.5176i 0.0837 - 0.0847i 0.1420 + 0.5890i 0.2537 + 0.5177i 0.0837 - 0.0847i 0.1420 + 0.5890i 0.2537 + 0.5178i 0.0837 - 0.0847i 0.1421 + 0.5890i 0.2536 + 0.5179i 0.0837 - 0.0847i 0.1421 + 0.5890i 0.2536 + 0.5180i 0.0837 - 0.0847i 0.1421 + 0.5890i 0.2536 + 0.5181i 0.0837 - 0.0847i 0.1421 + 0.5891i 0.2536 + 0.5182i 0.0836 - 0.0847i 0.1422 + 0.5891i 0.2535 + 0.5182i 0.0836 - 0.0847i 0.1422 + 0.5891i 0.2535 + 0.5183i 0.0836 - 0.0848i 0.1422 + 0.5891i 0.2535 + 0.5184i 0.0836 - 0.0848i 0.1422 + 0.5891i 0.2534 + 0.5185i 0.0836 - 0.0848i 0.1423 + 0.5891i 0.2534 + 0.5186i 0.0836 - 0.0848i 0.1423 + 0.5892i 0.2534 + 0.5187i 0.0836 - 0.0848i 0.1423 + 0.5892i 0.2533 + 0.5188i 0.0836 - 0.0848i 0.1423 + 0.5892i 0.2533 + 0.5189i 0.0836 - 0.0848i 0.1424 + 0.5892i 0.2533 + 0.5190i 0.0836 - 0.0848i 0.1424 + 0.5892i 0.2533 + 0.5191i 0.0836 - 0.0848i 0.1424 + 0.5892i 0.2532 + 0.5192i 0.0836 - 0.0848i 0.1424 + 0.5893i 0.2532 + 0.5193i 0.0836 - 0.0848i 0.1425 + 0.5893i 0.2532 + 0.5194i 0.0835 - 0.0848i 0.1425 + 0.5893i 0.2531 + 0.5195i 0.0835 - 0.0848i 0.1425 + 0.5893i 0.2531 + 0.5196i 0.0835 - 0.0848i 0.1425 + 0.5893i 0.2531 + 0.5197i 0.0835 - 0.0849i 0.1426 + 0.5894i 0.2530 + 0.5198i 0.0835 - 0.0849i 0.1426 + 0.5894i 0.2530 + 0.5199i 0.0835 - 0.0849i 0.1426 + 0.5894i 0.2530 + 0.5200i 0.0835 - 0.0849i 0.1426 + 0.5894i 0.2530 + 0.5201i 0.0835 - 0.0849i 0.1427 + 0.5894i 0.2529 + 0.5202i 0.0835 - 0.0849i 0.1427 + 0.5894i 0.2529 + 0.5203i 0.0835 - 0.0849i 0.1427 + 0.5895i 0.2529 + 0.5204i 0.0835 - 0.0849i 0.1428 + 0.5895i 0.2528 + 0.5205i 0.0835 - 0.0849i 0.1428 + 0.5895i 0.2528 + 0.5206i 0.0835 - 0.0849i 0.1428 + 0.5895i 0.2528 + 0.5207i 0.0835 - 0.0849i 0.1428 + 0.5895i 0.2527 + 0.5208i 0.0834 - 0.0849i 0.1429 + 0.5895i 0.2527 + 0.5209i 0.0834 - 0.0849i 0.1429 + 0.5896i 0.2527 + 0.5210i 0.0834 - 0.0850i 0.1429 + 0.5896i 0.2527 + 0.5211i 0.0834 - 0.0850i 0.1429 + 0.5896i 0.2526 + 0.5211i 0.0834 - 0.0850i 0.1430 + 0.5896i 0.2526 + 0.5212i 0.0834 - 0.0850i 0.1430 + 0.5896i 0.2526 + 0.5213i 0.0834 - 0.0850i 0.1430 + 0.5896i 0.2525 + 0.5214i 0.0834 - 0.0850i 0.1430 + 0.5897i 0.2525 + 0.5215i 0.0834 - 0.0850i 0.1431 + 0.5897i 0.2525 + 0.5216i 0.0834 - 0.0850i 0.1431 + 0.5897i 0.2524 + 0.5217i 0.0834 - 0.0850i
release(ricianchan);
ricianchan.RandomStream = 'Global stream';
rng(73)
[RicianChanOut2,RicianPathGains2] = ricianchan(modData);
isequal(RicianChanOut1,RicianChanOut2)
ans = logical
1
I suggest you recheck your code as the function "ricianchan" has no issues with input of dynamic length.

카테고리

Help CenterFile Exchange에서 Propagation and Channel Models에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by