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0,0,0,1,1,0,0;
1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0];
tx = [];
values = randsrc(1,1,[0:15]);
for k=1:length(values)
sym = values(k);
tx = [tx chip_values((sym+1),1:end)];
end;
tx = tx.';
h = modem.oqpskmod;
y = modulate(h, tx);
g = modem.oqpskdemod(h);
z = demodulate(g, y);
length(z)
for k=1:length(tx)
if(tx(k)~=z(k))
fprintf('%d %d\n',tx(k),z(k));
end;
end;
我的問題是,在這個簡單的例子,爲什麼我的TX和z不包含相同的值,儘管我沒有引入任何噪音?謝謝! TX的
值來如下:
列14到26
1 1 1 1 0 1 1 1 0 0 0 1 1
列27至32
0 0 1 0 0 1
的
值
列1至13
0 1 1 0 0 0 0 0 0 1 1 1 0
z com ES如下:
列1至13
3 0 1 1 0 0 0 0 0 0 1 1 1
列14到26
0 1 1 1 1 0 1 1 1 0 0 0 1
列27至32
1 0 0 1 0 0
h =
Type: 'OQPSK Modulator'
M: 4
PhaseOffset: 0
Constellation: [1x4 double]
SymbolOrder: 'Binary'
SymbolMapping: [0 1 2 3]
InputType: 'Integer'
g =
Type: 'OQPSK Demodulator'
M: 4
PhaseOffset: 0
Constellation: [1x4 double]
SymbolOrder: 'Binary'
SymbolMapping: [0 1 2 3]
OutputType: 'Integer'
DecisionType: 'Hard decision'
您的輸入和輸出是邏輯類型嗎?如果他們是浮點數,你可能會遇到比較錯誤。 – gnovice 2010-02-19 03:56:40
我不想通過強制將它們轉換,我想了解它爲什麼會按照它現在的方式執行它:)提前致謝! – 2010-02-24 07:35:46