Error using symbol synchronizer

조회 수: 18 (최근 30일)
Alan Heradio Luna
Alan Heradio Luna 2019년 4월 10일
I am trying to correct the timing offset using the symbol sync but I am getting an error "Changing the size on input 1 is not allowed without first calling the release() method." my code is:
%% General system details
sampleRateHz = 1e6; samplesPerSymbol = 8;
frameSize = 2^10; numFrames = 200;
numSamples = numFrames*frameSize; % Samples to simulate
modulationOrder = 2; filterSymbolSpan = 4;
%% Visuals
cdPre = comm.ConstellationDiagram('ReferenceConstellation', [-1 1],...
'Name','Baseband');
cdPost = comm.ConstellationDiagram('ReferenceConstellation', [-1 1],...
'Name','Baseband with Timing Offset');
cdTiming = comm.ConstellationDiagram('ReferenceConstellation',[-1 1], ...
'SymbolsToDisplaySource', 'Property','Name','Timing Synchronized Signal');
cdPre.Position(1) = 50;
cdPost.Position(1) = cdPre.Position(1)+cdPre.Position(3)+10;% Place side by side
%% Impairments
snr = 15; timingOffset = samplesPerSymbol*0.01; % Samples
%% Generate symbols
data = randi([0 modulationOrder-1], numSamples*2, 1);
mod = comm.DBPSKModulator(); modulatedData = mod(data);
%% Add TX/RX Filters
TxFlt = comm.RaisedCosineTransmitFilter(...
'OutputSamplesPerSymbol', samplesPerSymbol,...
'FilterSpanInSymbols', filterSymbolSpan);
RxFlt = comm.RaisedCosineReceiveFilter(...
'InputSamplesPerSymbol', samplesPerSymbol,...
'FilterSpanInSymbols', filterSymbolSpan,...
'DecimationFactor', samplesPerSymbol);
RxFltRef = clone(RxFlt);
symbolSync = comm.SymbolSynchronizer(...
'SamplesPerSymbol',samplesPerSymbol, ...
'TimingErrorDetector','Gardner (non-data-aided)');
%% Add noise source
chan = comm.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)','SNR',snr, ...
'SignalPower',1,'RandomStream', 'mt19937ar with seed');
%% Add delay
varDelay = dsp.VariableFractionalDelay;
%% Model of error
% Add timing offset to baseband signal
filteredData = [];
for k=1:frameSize:(numSamples - frameSize)
timeIndex = (k:k+frameSize-1).';
% Filter signal
filteredTXData = TxFlt(modulatedData(timeIndex));
% Pass through channel
noisyData = chan(filteredTXData);
% Time delay signal
offsetData = varDelay(noisyData, k/frameSize*timingOffset);
% Filter signal
filteredData = RxFlt(offsetData);
filteredDataRef = RxFltRef(noisyData);
y = interp(filteredData,samplesPerSymbol);
release(symbolSync)
rxSync = symbolSync(filteredData);
% Visualize Error
cdPre(filteredDataRef);
cdPost(filteredData);
cdTiming(rxSync);
pause(0.1); %#ok<*UNRCH>
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Sources and Sinks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by