请教高手:帮我看这个程序
这个程序是关于pi/4-dqpsk的调制主程序如下:
BitStreamLength = 10000;
BitStream = rand(1,BitStreamLength)>0.5;
= SerialToParallel(BitStream);
= DQPSKEncoder(BitStreamOne,BitStreamTwo);
= TransmitFilter(I_SymbolsTx,Q_SymbolsTx, \\
hTransmitFilter,numSamplesPerSymbol);
每次运行的错误显示如下:
??? Error: File: F:\资料\matlab仿真\pi4DQPSK\zhuchengxu.m Line: 6 Column: 71
Missing variable or function.
以下是各部分的调用函数:
function Phase = CalcPhase(BitVector)
switch BitVector(1)
case 0,
switch BitVector(2)
case 0, % case
Phase = pi/4;
case 1, % case
Phase = 3*pi/4;
end
case 1,
switch BitVector(2)
case 0, % case
Phase = -pi/4;
case 1, % case
Phase = -3*pi/4;
end
end
% pi/4 shifter DQPSK Encoder.
function = DQPSKEncoder(BitStreamOneTx, BitStreamTwoTx)
% This is supposed to be (I(-1) + jQ(-1)).
InitialSymbol = (1+0i);
I_StreamLength = length(BitStreamOneTx);
Q_StreamLength = I_StreamLength;
% -------------------> Differential Modulation <------------------------------- %
% Do the Differential Modulation and generate the baseband-complex signal.
% Calculate the phase-shift due to the first symbol.
PhaseShift(1) = CalcPhase();
% The first modulated symbol.
ModulatedSymbol(1) = (InitialSymbol)*exp(i*PhaseShift(1));
% The other symbols calculated iteratively.
for index = 2:1:I_StreamLength
% The phase shift due to the ith modulated symbol.
PhaseShift(index) = CalcPhase();
% Rotated the modulated symbol phasor to the new position.
ModulatedSymbol(index) = ModulatedSymbol(index-1)*exp(j*PhaseShift(index));
end
% Extract the I and Q parts of the Symbol.
I_Symbols = real(ModulatedSymbol);
Q_Symbols = imag(ModulatedSymbol);
function = SerialToParallel(BitStream)
BitStreamOne = BitStream(1:2:length(BitStream));
BitStreamTwo = BitStream(2:2:length(BitStream));
% Converts a Symbol stream to a Waveform containing impulses.
function = SymbolToWaveform(SymbolStream,numSamplesPerSymbol)
lenWaveform = length(SymbolStream)*numSamplesPerSymbol;
Waveform = zeros(1,lenWaveform);
Waveform(1:numSamplesPerSymbol:lenWaveform) = SymbolStream;
function = TransmitFilter(I_Symbols,Q_Symbols,hTransmitFilter,numSamplesPerSymbol)
% The first step is to convert the symbol stream into a digital signal so that it can
% be filtered.
I_Waveform = SymbolToWaveform(I_Symbols,numSamplesPerSymbol);
Q_Waveform = SymbolToWaveform(Q_Symbols,numSamplesPerSymbol);
% The next step is to filter the signal to obtain the transmit waveforms.
I_TxWaveform = conv(I_Waveform,hTransmitFilter);
Q_TxWaveform = conv(Q_Waveform,hTransmitFilter); 原帖由 liyanping2007 于 2007-5-7 09:18 发表 http://forum.vibunion.com/forum/images/common/back.gif
这个程序是关于pi/4-dqpsk的调制
主程序如下:
BitStreamLength = 10000;
BitStream = rand(1,BitStreamLength)>0.5;
= SerialToParallel(BitStream);
= DQPSKEncoder(BitStreamOne,BitStreamTwo);
= T ...
文件路径问题,建议不要使用中文。更多的请参阅“置顶贴:聚宝盆”里面的以下信息:
8. 对于初学者,建议先阅读以下链接的精华帖:[原创]写给学习 matlab 的新手们
页:
[1]