📄 examp_ofdm.m
字号:
%EXAMP_OFDM Example of Gabor systems used for OFDM%% This example shows how to use a Gabor Riesz basis for OFDM.% The example is simple, and assumes that all the whole spectrum% is available for transmission.%% Some further simplifications used to make this example simple:%% - The window and its dual have full length support. This is not% practical, because all data would have to be processed at once.% Instead, a filter bank approach should be used, with both the% window and its dual having a short length. %% - The window is periodic. The data at the very end interferes with% the data at the very beginning. A simple way to solve this is to% transmit zeros at the beginning and at the end, to flush the system% properly.%% FIGURE 1 Received coefficients.%% This figure shows the distribution in the complex plane of the % received coefficients.%% This program is free software: you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation, either version 3 of the License, or% (at your option) any later version.% % This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% GNU General Public License for more details.% % You should have received a copy of the GNU General Public License% along with this program. If not, see <http://www.gnu.org/licenses/>.disp('Type "help examp_ofdm" to see a description of how this example works.');% ----------- setup ------------------------% Number of channels to useM=16;% Time-distance between succesive transmission. This must be% larger than M, otherwise the symbols will interfere.a=32;% Order of QAMqamorder=4;% Number of bits to transmit, must be divisable by log2(qamorder)*Mnbits=16000;% Noiselevel for the channel.noiselevel=0.1;% Maximum spread in time, must be even for simplicitytspread=2;% Maximum spread in frequencyfspread=2;% Length (in samples) of transmitted signal.L=nbits/(log2(qamorder)*M)*a;% We choose an orthonormal window.g=cantight(a,M,L);% ------------ preparation of input data -------------------% Create a random stream of bits.inputdata=round(rand(nbits,1));% QAM modulate ittransmitdata=qam(inputdata,qamorder);% Create the signal to be tranmittedf=idgt(reshape(transmitdata,M,[]),g,a);% --- transmission of signal - influence of the channel ----------% Construct the symbol of the underspread operator.symbol=sparse(L,L);%symbol(1:fspread/2,[L-tspread/2+1:L,1:tspread/2])=randn(fspread/2,tspread);symbol(1,2)=1;% Make the symbol conserve real signals.symbol=(symbol+involute(symbol))/2;% Apply the underspread operator.f=spreadop(f,symbol);% add white noise.%f=f+noiselevel*((randn(size(f))-.5)+i*(randn(size(f))-.5));% --- reconstruction of received signal.receivedcoefficients = dgt(f,g,a,M);% Plot the coefficients in the complex plane.figure(1);if isoctave plot(receivedcoefficients(:),'.;;');else plot(receivedcoefficients(:),'.');end;receivedbits=iqam(receivedcoefficients(:),qamorder);% Test for errors.disp(' ');disp('Number of faulty bits:');faulty=sum(abs(receivedbits-inputdata))disp(' ');disp('Error rate:');faulty/nbits
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -